dqiatvbi61502
2019-05-12 12:54
采纳率: 0%
浏览 211
已采纳

在WooCommerce中重定向到Checkout滚动到结算详细信息添加到购物车

I am trying to achieve a new button on the archive which will add the product to the cart, redirect to the checkout page and scroll down to the billing details.

Nothing happens when using this code:

add_filter ('add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url()#billing_details;
return $checkout_url;
}

It gives on error for this line:

$checkout_url = $woocommerce->cart->get_checkout_url()#billing_details;

图片转代码服务由CSDN问答提供 功能建议

我正在尝试在存档上创建一个新按钮,将产品添加到购物车,重定向到结帐 页面并向下滚动到结算明细。</ p>

使用此代码时没有任何反应:</ p>

  add_filter('add_to_cart_redirect','redirect_to_checkout'  ); 
 
函数redirect_to_checkout(){
global $ woocommerce; 
 $ checkout_url = $ woocommerce-&gt; cart-&gt; get_checkout_url()#cilling_details; 
return $ checkout_url; 
} 
 </ code> </ pre  > 
 
 

它给出了这一行的错误:</ p>

  $ checkout_url = $ woocommerce-&gt; cart-&gt; get_checkout_url()#cilling_details; 
  </ code> </ pre> 
 </ div>

1条回答 默认 最新

相关推荐 更多相似问题