1
我正在使用Woocommerce創建電子商務網站,我需要一些重定向幫助。所以佈局是類別1類別2的圖像等。繼續購物重定向到woocommerce中的上一個類別
當類別1被點擊時,它打開類別1a類別1b等等,當類別1a被點擊時,它打開產品列表。
如果用戶位於類別1a的第3頁並點擊產品。它會轉到單個產品頁面,並在他們點擊添加到購物車時。它現在進入購物車頁面,並提供繼續購物的選項。當用戶點擊繼續購物,我希望它回到category1a 3頁,或者更簡單,在特定類別的用戶是英寸
與下面的代碼,我設法將其重定向到主力店頁面,但客戶正在請求去用戶點擊產品前的位置。
add_filter('woocommerce_add_to_cart_message', 'woocommrece_custom_add_to_cart_message');
功能woocommrece_custom_add_to_cart_message(){
global $woocommerce;
//輸出成功消息
if (get_option('woocommerce_cart_redirect_after_add') == 'yes') {
$return_to = get_permalink(woocommerce_get_page_id('shop')); // Give the url, you want to redirect which would be previous location before user clicked on product
$message = sprintf('<a href="%s" class="button">%s</a> %s', $return_to, __('More Donation Options →', 'woocommerce'), __('Donation successfully added to your cart.', 'woocommerce'));
} else {
$message = sprintf('<a href="%s">%s</a> %s', get_permalink(woocommerce_get_page_id('cart')), __('View Cart →', 'woocommerce'), __('added to cart.', 'woocommerce'));
}