現在,點擊存檔頁面上的「添加到圖表」按鈕會將產品添加到購物車,但也會將定製商重定向到某個產品的頁面,並且我試圖在點擊後禁用任何重定向「添加到購物車」按鈕。我希望定製者在點擊按鈕之前停留在他所在的同一頁面上,或者僅在添加到購物車後「刷新」頁面。禁用添加到購物車重定向
有什麼建議嗎?
/**
* Redirect subscription add to cart to checkout page
*
* @param none
*/
function add_to_cart_checkout_redirect() {
wp_safe_redirect(get_permalink(get_option(
'woocommerce_checkout_page_id')));
die();
}
add_action('woocommerce_add_to_cart', 'add_to_cart_checkout_redirect', 11
);
你的代碼在哪裏? –
@JunaidAhmed添加代碼 – Moo
默認情況下,從存檔頁面添加到購物車是通過ajax完成的,不應該刷新頁面。 – helgatheviking