如何将特定的运输区域ID放入此代码中?

时间:2018-08-24 08:42:23

标签: php wordpress woocommerce shipping

您好,我有此代码,我尝试了很多次以放置特定的运输区域ID,但无济于事。谁能和我分享?

URL中的示例区域ID https://www.domainname.com/wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=21

如何在代码中添加zone_id = 21?

// Put inside packages
        if ( $special_items ) {
            $packages[] = array(
                'ship_via' => array( 'flat_rate' ),
                'contents' => $special_items,
                'contents_cost' => array_sum( wp_list_pluck( $special_items, 'line_total' ) ),
                'applied_coupons' => WC()->cart->applied_coupons,
                'destination' => array(
                    'country' => WC()->customer->get_shipping_country(),
                    'state' => WC()->customer->get_shipping_state(),
                    'postcode' => WC()->customer->get_shipping_postcode(),
                    'city' => WC()->customer->get_shipping_city(),
                    'address' => WC()->customer->get_shipping_address(),
                    'address_2' => WC()->customer->get_shipping_address_2(),
                ),
            );
        }

0 个答案:

没有答案