رو برو شدید.الگوي شما توسط پشتيباني ووکامرس شناسايي نميشود – اگر با مشکل ناسازگاري طرح مواجه شديد، راهنماي يکپارچگي را مطالعه کنيد يا يکي از الگوهاي ووکامرس را انتخاب کنيد
add_theme_support( 'woocommerce' );
http://www.site.com/wp-admin/admin.php?page=woocommerce_settings&tab=general
http://site.com/woo2/wp-admin/admin.php?page=woocommerce_settings&tab=catalog
<?php
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
function woo_custom_cart_button_text() {
return __( 'بریز تو سبد', 'woocommerce' );
}
?>
<?php
add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text'); function woo_custom_cart_button_text() { return __('میخرمش!', 'woocommerce');
} ?>
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
global $woocommerce;
$minimum = 20000;
if ( $woocommerce->cart->total() < $minimum ) {
$woocommerce->add_error( sprintf( 'برای تکمیل سفارش شما باید حداقل %s خرید کنید' , $minimum ) );
}
}
function wc_remove_related_products( $args ) {
return array();
}
add_filter('woocommerce_related_products_args','wc_remove_related_products', 10);
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );
add_action( 'init', 'custom_fix_thumbnail' );
function custom_fix_thumbnail() {
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src( $src ) {
$upload_dir = wp_upload_dir();
$uploads = untrailingslashit( $upload_dir['baseurl'] );
$src = $uploads . '/2012/07/thumb1.jpg';
return $src;
}
}
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 );
function wc_product_sold_count() {
global $product;
$units_sold = get_post_meta( $product->id, 'total_sales', true );
echo '<p>' . sprintf( __( 'تعداد فروش: %s', 'woocommerce' ), $units_sold ) . '</p>';
}
add_action( 'woocommerce_check_cart_items', 'woocommerce_check_cart_quantities' );
function woocommerce_check_cart_quantities() {
global $woocommerce;
$multiples = 6;
$total_products = 0;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$total_products += $values['quantity'];
}
if ( ( $total_products % $multiples ) > 0 )
$woocommerce->add_error( sprintf( __('شما حداقل می بایست %s محصول خریداری کنید', 'woocommerce'), $multiples ) );
}
// Limit cart items with a certain shipping class to be purchased in multiple only
add_action( 'woocommerce_check_cart_items', 'woocommerce_check_cart_quantities_for_class' );
function woocommerce_check_cart_quantities_for_class() {
global $woocommerce;
$multiples = 6;
$class = 'bottle';
$total_products = 0;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$product = get_product( $values['product_id'] );
if ( $product->get_shipping_class() == $class ) {
$total_products += $values['quantity'];
}
}
if ( ( $total_products % $multiples ) > 0 )
$woocommerce->add_error( sprintf( __('شما برای ارسال سفارش می بایست حداقل %s عدد خرید کنید.', 'woocommerce'), $multiples ) );
}
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_filter( 'woocommerce_product_tabs', 'wc_remove_description_tab', 11, 1 );
function wc_remove_description_tab( $tabs ) {
if ( isset( $tabs['description'] ) ) {
unset( $tabs['description'] );
}
}