Answers for "woocommerce_before_add_to_cart_button get product id"

C
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

woocommerce show before add to cart button

add_action( 'woocommerce_before_add_to_cart_button', 'misha_before_add_to_cart_btn' );

function misha_before_add_to_cart_btn(){
	echo 'Some custom text here';
}
Posted by: Guest on March-27-2022

Code answers related to "woocommerce_before_add_to_cart_button get product id"

Code answers related to "C"

Browse Popular Code Answers by Language