woocommerce add to cart link
www.yourwebsite.com/?add-to-cart=your product id
woocommerce add to cart link
www.yourwebsite.com/?add-to-cart=your product id
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 );
}
}
woocommerce add to cart link
www.yourwebsite.com/?add-to-cart=your product id
add to cart function woocommerce
// To change add to cart text on single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' );
function woocommerce_custom_single_add_to_cart_text() {
return __( 'Buy Now', 'woocommerce' );
}
// To change add to cart text on product archives(Collection) page
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );
function woocommerce_custom_product_add_to_cart_text() {
return __( 'Buy Now', 'woocommerce' );
}
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 );
}
}
add to cart function woocommerce
// To change add to cart text on single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' );
function woocommerce_custom_single_add_to_cart_text() {
return __( 'Buy Now', 'woocommerce' );
}
// To change add to cart text on product archives(Collection) page
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );
function woocommerce_custom_product_add_to_cart_text() {
return __( 'Buy Now', 'woocommerce' );
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us