我需要计算的额外运输成本的缺货产品将有。我首先想到的是复制每个产品的运输成本,但这是不准确的。所以我想我应该使用我的函数运行另一个函数(与woocommerce使用的相同)来计算购物车中每个和所有缺货产品的运输成本。 这就是我到目前为止所在的地方。 // Add a extra shipping fee to each backordered product
add_action('woocommerce_cart_calculate_fees', 'add_backorder_shipping_fee', 20, 1);
function add_backo
我试图隐藏除了一个基于发货类的发货方法之外的所有方法,本质上是在选择属于特定类的产品时强制使用FedEx通宵方法。
我从开始,并修改它,如下所示:
add_filter( 'woocommerce_available_shipping_methods', 'hide_shipping_based_on_class' , 10, 1 );
function check_cart_for_share() {
// load the contents of the cart into an array.
global $woocommerce;
$cart
我需要设置最大重量125公斤每订单,但只对产品与航运类名为"sypkie“。我有下面的代码和它的工作,但所有的产品在购物车。我想使它只适用于"sypkie“运输类的产品。
add_action('woocommerce_check_cart_items','check_cart_weight');
function check_cart_weight(){
global $woocommerce;
$weight = $woocommerce->cart->cart_contents_weight;
if(
如果客户发货国不是意大利,我正试图禁用某一特定产品的运输。
这是我的代码,但我不知道如何设置国家条件:
function hide_shipping_when_class_is_in_cart( $rates, $package ) {
// shipping class IDs that need the method removed
$shipping_classes = array('bulky-items');
$if_exists = false;
foreach( $package['contents'] as $k
我的问题与WooCommerce运输方法有关。
我想给出两种运输方法:
1. Shipping (Use a predefined shipping method) to send the gift certificate
2. Send by email
我不能将它定义为虚拟产品,因为我需要使用配送功能。但同时,我需要给用户在结帐前发送电子邮件的选项,因此它将是一种无需发货的虚拟产品,而是动态的。
我使用的,但它没有可能给用户的选择,如果他想发送它或发送电子邮件。
有什么建议吗?
您能告诉我如何调整这个片段(它禁用某个产品的免费送货方法),以便在购物车有产品/S指定某个运输类时禁用免费送货方法?(WooCommerce 4.2+)
任何帮助都很感激。谢谢。
function my_free_shipping( $is_available ) {
global $woocommerce;
// set the product ids that are ineligible
$ineligible = array( '4743' );
// get cart contents
$cart_items = $wooc
我想将产品权重添加到订单中列出的每个变量中,但我在Woocommerce的php中遇到了困难,因此我在这里呼吁。
我已经定制了WooCommerce是一个报价请求系统而不是一个订购系统,我希望可变单位重量(每个工业产品的每个变体都有不同的重量)上的管理-新-订单为每个项目,以便其高度可见的个人把定制的报价,包括定制的国际运输所需的单个订单(因为很多工业部件是非常重和运输,昂贵)。
我已经知道,在email-order-items.php中添加代码是可行的。但我不知道从标准重量输入字段中提取重量并在变化信息后将其显示为“X kg per unit”的代码。
注意:我已经在我的孩子主题下设置了电子