Home › Forums › WoodMart support forum › Add to cart not working properly › Reply To: Add to cart not working properly
December 27, 2022 at 12:56 pm
#431495
Artem Temos
Keymaster
Hello,
Try to add the following PHP code snippet to the child theme functions.php file to fix this
add_filter('woocommerce_add_to_cart_redirect', function( $url ) {
if( strpos( $url, 'product-added-to-cart' ) > 0 || strpos( $url, 'product_added_to_cart' ) > 0) {
if ( isset( $_REQUEST['wd-add-to-cart'] ) ) {
return wc_get_checkout_url();
}
return '';
}
return $url;
}, PHP_INT_MAX);
Kind Regards