Answers for "woocommerce adding item to cart with code"

0

add_to_cart how to call it woocommerce

add_action( 'template_redirect', 'quadlayers_add_to_cart_function' );

function quadlayers_add_to_cart_function () {

    $product_id = 1326;

    if ( WC()->cart->get_cart_contents_count() == 0 ) {

        WC()->cart->add_to_cart( $product_id );

    }

}
Posted by: Guest on December-08-2020
0

add a item to cart woocomerce with quantity

WC()->cart->add_to_cart( 500, 5 );
Posted by: Guest on December-08-2020
0

add_to_cart how to call it woocommerce

add_action( 'template_redirect', 'quadlayers_add_to_cart_function' );

function quadlayers_add_to_cart_function () {

    $product_id = 1326;

    if ( WC()->cart->get_cart_contents_count() == 0 ) {

        WC()->cart->add_to_cart( $product_id );

    }

}
Posted by: Guest on December-08-2020
0

add a item to cart woocomerce with quantity

WC()->cart->add_to_cart( 500, 5 );
Posted by: Guest on December-08-2020

Code answers related to "woocommerce adding item to cart with code"

Browse Popular Code Answers by Language