• Resolved marco978

    (@marco978)


    If have added this snippet to function.php. wc_add_notice error fires except with paypal express checkout plugin. Can you please help me?

    // Set a minimum amount of oder based on shipping zone before checking out
    add_action( 'woocommerce_check_cart_items', 'cw_min_num_products' );
    // Only run in the Cart or Checkout pages
    function cw_min_num_products() {
    	if( is_cart() || is_checkout() ) {
    		global $woocommerce;
    		// Set the minimum order amount and shipping zone before checking out
    		$minimum = 150;
    		$county = array('GB');
    		// Defining var total amount
    		$cart_tot_order = WC()->cart->subtotal;
    		if( $cart_tot_order <= $minimum && in_array( WC()->customer->get_shipping_country(), $county ) ) {
    		// Display error message
    		wc_add_notice( sprintf( '<strong>A Minimum order of &euro; %s is required before checking out.</strong>'
    		. '<br />Current order: &euro; %s.',
    		$minimum,
    		$cart_tot_order ),
    		'error' );
    		}
    	}

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Niall a11n

    (@wpniall)

    Hi @marco978,

    Thanks for reaching out to us!

    This request involves a fairly complex development topic and it might be worthwhile reaching out to the web developer community at large to review any code that you’ve already written.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    Plugin Support Niall a11n

    (@wpniall)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wc_add_notice does not fire’ is closed to new replies.