Hướng dẫn custom woocommerce phần 10: trong phần này chúng ta sẽ đi tìm hiểu về thiết lập thuế và chi phí giao nhận cho đơn hàng trong woocommerce(tax and shipping woocommerce)
Code liên quan tới video:(thêm phương thức chuyển fax nhanh trong phần chi phí giao nhận)
1
2
3
4
5
6
7
8
9
10
11
|
add_action( 'woocommerce_flat_rate_shipping_add_rate', 'add_another_custom_flat_rate', 10, 2 );
function add_another_custom_flat_rate( $method, $rate ) {
$new_rate = $rate;
$new_rate['id'] .= ':' . 'chuyen_fax_thuong'; // Append a custom ID
$new_rate['label'] = 'Chuyển fax thường'; // Rename to 'Rushed Shipping'
$new_rate['cost'] = 4000; // Add $2 to the cost
// Add it to WC
$method->add_rate( $new_rate );
}
|
0 nhận xét: