با سلام
فکر کنم باید یک فروم بهتر برای ووکامرس درست کنیم و دوستان حرفه ای تری جذب بشن
چون من هر سوالی که تو این فروم کردم به جواب نرسیدم و خودم آخر توانستم مشکل خود را حل کنم
....
آموزش
اگر مبلغ محصول شما صفر باشد و دوست ندارید به اتمام پرداخت برسد مشتری
این کد را به فانکشن قالب خود اضافه کنید
//مبلغ
// Set a minimum dollar amount per order
add_action( 'woocommerce_check_cart_items', 'spyr_set_min_total' );
function spyr_set_min_total() {
// Only run in the Cart or Checkout pages
if( is_cart() || is_checkout() ) {
global $woocommerce;
// Set minimum cart total
$minimum_cart_total = 1;
// Total we are going to be using for the Math
// This is before taxes and shipping charges
$total = WC()->cart->subtotal;
// Compare values and add an error is Cart's total
// happens to be less than the minimum required before checking out.
// Will display a message along the lines of
// A Minimum of 10 USD is required before checking out. (Cont. below)
// Current cart total: 6 USD
if( $total <= $minimum_cart_total ) {
// Display our error message
wc_add_notice( sprintf( '<strong>مبلغ مورد نظر درست نیست.</strong>'
.'<br />',
$minimum_cart_total,
get_option( 'woocommerce_currency'),
$total,
get_option( 'woocommerce_currency') ),
'error' );
}
}
}
پیروز باشید
فکر کنم باید یک فروم بهتر برای ووکامرس درست کنیم و دوستان حرفه ای تری جذب بشن
چون من هر سوالی که تو این فروم کردم به جواب نرسیدم و خودم آخر توانستم مشکل خود را حل کنم
....
آموزش
اگر مبلغ محصول شما صفر باشد و دوست ندارید به اتمام پرداخت برسد مشتری
این کد را به فانکشن قالب خود اضافه کنید
//مبلغ
// Set a minimum dollar amount per order
add_action( 'woocommerce_check_cart_items', 'spyr_set_min_total' );
function spyr_set_min_total() {
// Only run in the Cart or Checkout pages
if( is_cart() || is_checkout() ) {
global $woocommerce;
// Set minimum cart total
$minimum_cart_total = 1;
// Total we are going to be using for the Math
// This is before taxes and shipping charges
$total = WC()->cart->subtotal;
// Compare values and add an error is Cart's total
// happens to be less than the minimum required before checking out.
// Will display a message along the lines of
// A Minimum of 10 USD is required before checking out. (Cont. below)
// Current cart total: 6 USD
if( $total <= $minimum_cart_total ) {
// Display our error message
wc_add_notice( sprintf( '<strong>مبلغ مورد نظر درست نیست.</strong>'
.'<br />',
$minimum_cart_total,
get_option( 'woocommerce_currency'),
$total,
get_option( 'woocommerce_currency') ),
'error' );
}
}
}
پیروز باشید