زیادکردنی فرۆشی ئۆنلاین - شێوازی دووەم

زیادکردنی فرۆشی ئۆنلاین بە تەکنیکی دووەم

لەم شێوازەدا لە سەبەتەی کڕین و لە لاپەڕەی پارەدان پەیامێک پیشانی کڕیارەکە دەدەیت کە ئەگەر بڕی کڕینەکە لە بڕی خوازراو زیاتر بوو ئەوا دیارییەکی بەنرخ بە شێوەیەکی ئۆتۆماتیکی دەدرێت بە بەکارهێنەر. بۆ ئەوەی سیستەمەکە بە شێوەیەکی ئۆتۆماتیکی بەرهەمێکی دیاری بۆ بەکارهێنەر لە کۆدی بانگەشەکردنەوە لەبەرچاو بگرێت یەکەم شێوازی فرۆشتنی ئۆنلاین استفاده کنید اما از همین کد می توانید به صورتی دیگر هم استفاده کنید، یک روش ارسال رایگان با مبلغ مشخص ایجاد کنید و متن پیام را به این صورت تغییر دهید، در صورت خرید بیش از مبلغ تعیین شده، ارسال شما رایگان خواهد شد   این کد را باید در انتهای فایل فانکشن خود قرار بدید و آن را ذخیره کنید.

// Show "XX to free shipping or gift" notification in Woocommerce
add_action( 'woocommerce_before_cart_table', 'cart_page_notice' );
 
function cart_page_notice() {
	$min_amount = 2000000; //This is the amount of your free shipping threshold. Change according to your free shipping settings
	$current = WC()->cart->subtotal;
	if ( $current < $min_amount ) {
	$added_text = '<div class="woocommerce-message"><strong>Buy  ' . wc_price( $min_amount - $current ) . ' more, get your gift and send it for free</strong>'; // This is the message shown on the cart page
	$return_to = wc_get_page_permalink( 'shop' );
	$notice = sprintf( '%s<a class="button" href="/ku/%s/">%s</a>', $added_text, esc_url( $return_to ), 'Add product</div>' ); // This is the text shown below the notification. Link redirects to the shop page
	echo $notice;
	}
}



add_action( 'woocommerce_before_checkout_form', 'Rezvan_add_checkout_content', 11 );
function Rezvan_add_checkout_content() {
	$min_amount = 2000000; //This is the amount of your free shipping threshold. Change according to your free shipping settings
	$current = WC()->cart->subtotal;
	if ( $current < $min_amount ) {
	$added_text = '<div class="woocommerce-message"><strong>Buy  ' . wc_price( $min_amount - $current ) . ' more, get your gift and send it for free</strong>'; // This is the message shown on the cart page
	$return_to = wc_get_page_permalink( 'shop' );
	$notice = sprintf( '%s<a class="button" href="/ku/%s/">%s</a>', $added_text, esc_url( $return_to ), 'Add product</div>' ); // This is the text shown below the notification. Link redirects to the shop page
	echo $notice;
	}
}

وەڵامێک بنووسە

پۆستی ئەلیکترۆنییەکەت بڵاوناکرێتەوە. خانە پێویستەکان دەستنیشانکراون بە *

 
چاتی ئۆنلاین

ئامادەین بۆ وەڵامدانەوەی پرسیارەکانتان