How to Allow WordPress WooCommerce Direct Order to WhatsApp Free.

// Add custom checkbox and WhatsApp number fields to product edit page add_action('woocommerce_product_options_general_product_data', 'add_whatsapp_order_fields'); function add_whatsapp_order_fields() { woocommerce_wp_checkbox(array( 'id' => 'allow_whatsapp_order', 'label' => __('Allow WhatsApp Order', 'text-domain'), 'description' => __('Check this box to enable WhatsApp ordering for this product.', 'text-domain'), )); woocommerce_wp_text_input(array( 'id' => '_whatsapp_number', 'label' => __('WhatsApp Number', 'text-domain'), 'placeholder' => __('Enter WhatsApp Number', […]

Woocommerce: How to add minimum amount for different categories with different amount per category with different notice.

// Display notice on single product page for specific category add_action(‘woocommerce_before_single_product_summary’, ‘display_category_notice’); function display_category_notice() { global $product; $categories = get_categories_with_minimum_amount(); $cart_items = WC()->cart->get_cart(); $notices = array(); foreach ($categories as $category_name => $minimum_amount) { if (has_term($category_name, ‘product_cat’, $product->get_id(), false)) { $category_total = 0; foreach ($cart_items as $cart_item) { if (has_term($category_name, ‘product_cat’, $cart_item[‘product_id’], false)) { $category_total += […]

Login To Access Code Snippet:

Stay UpTo Date with Latest Post And news: