woocommerce

Redirect to custom URL after user clicks 'Proceed to checkout' at the cart page (wordpress)

喜你入骨 提交于 2021-02-18 18:50:42
问题 When user clicks 'Proceed to checkout' at the cart page, I would like to send him to custom URL. I used this filter in functions.php add_filter('woocommerce_get_checkout_url', 'dj_redirect_checkout'); function dj_redirect_checkout($url) { global $woocommerce; $checkout_url = 'http://my-custom-url.com'; return $checkout_url; } However, in this case this filter is triggered on the checkout page as well and I would like to trigger it on the Cart page and after the click 'Proceed to checkout'

Redirect to custom URL after user clicks 'Proceed to checkout' at the cart page (wordpress)

南笙酒味 提交于 2021-02-18 18:50:31
问题 When user clicks 'Proceed to checkout' at the cart page, I would like to send him to custom URL. I used this filter in functions.php add_filter('woocommerce_get_checkout_url', 'dj_redirect_checkout'); function dj_redirect_checkout($url) { global $woocommerce; $checkout_url = 'http://my-custom-url.com'; return $checkout_url; } However, in this case this filter is triggered on the checkout page as well and I would like to trigger it on the Cart page and after the click 'Proceed to checkout'

Display specific product attributes under product title in Woocommerce archive pages

倖福魔咒の 提交于 2021-02-18 18:19:33
问题 In woocommerce, I would like to show some product attributes on shop page under the product titles. This product attributes are "year", "model" and "oil". This is what I have for now: add_action('woocommerce_shop_loop_item_title', 'wh_insertAfterShopProductTitle', 15); function wh_insertAfterShopProductTitle() { global $product; $abv = $product->get_attribute('pa_year'); if (empty($abv)) return; echo __($abv, 'woocommerce'); } Any help is appreciated. 回答1: To display "year", "model" and "oil"

Display specific product attributes under product title in Woocommerce archive pages

≯℡__Kan透↙ 提交于 2021-02-18 18:18:48
问题 In woocommerce, I would like to show some product attributes on shop page under the product titles. This product attributes are "year", "model" and "oil". This is what I have for now: add_action('woocommerce_shop_loop_item_title', 'wh_insertAfterShopProductTitle', 15); function wh_insertAfterShopProductTitle() { global $product; $abv = $product->get_attribute('pa_year'); if (empty($abv)) return; echo __($abv, 'woocommerce'); } Any help is appreciated. 回答1: To display "year", "model" and "oil"

Woocommerce custom coupon type with custom discount always return 0;

ε祈祈猫儿з 提交于 2021-02-18 18:13:10
问题 what I am trying to do is creating custom coupon type with custom programmatically discount in woocommerce using hooks. This what my code looks like //add new coupon type called "custom_discount" function custom_discount_type( $discount_types ) { $discount_types['custom_discount'] =__( 'custom discount', 'woocommerce' ); return $discount_types; } // add the hooks add_filter( 'woocommerce_coupon_discount_types', 'custom_discount_type',10, 1); //function to get coupon amount for "custom

Woocommerce custom coupon type with custom discount always return 0;

拟墨画扇 提交于 2021-02-18 18:12:58
问题 what I am trying to do is creating custom coupon type with custom programmatically discount in woocommerce using hooks. This what my code looks like //add new coupon type called "custom_discount" function custom_discount_type( $discount_types ) { $discount_types['custom_discount'] =__( 'custom discount', 'woocommerce' ); return $discount_types; } // add the hooks add_filter( 'woocommerce_coupon_discount_types', 'custom_discount_type',10, 1); //function to get coupon amount for "custom

Woocommerce custom coupon type with custom discount always return 0;

a 夏天 提交于 2021-02-18 18:12:35
问题 what I am trying to do is creating custom coupon type with custom programmatically discount in woocommerce using hooks. This what my code looks like //add new coupon type called "custom_discount" function custom_discount_type( $discount_types ) { $discount_types['custom_discount'] =__( 'custom discount', 'woocommerce' ); return $discount_types; } // add the hooks add_filter( 'woocommerce_coupon_discount_types', 'custom_discount_type',10, 1); //function to get coupon amount for "custom

Format billing phone number on WooCommerce checkout

南楼画角 提交于 2021-02-18 18:12:01
问题 For the WooCommerce checkout billing field, how can I make this field require 9 numbers and insert dashes for proper phone formatting? For example, instead of typing out 3053453212 in the phone number field, it displays: (305-345-3212) 回答1: Based on "Formatting a phone number in a form using jquery" answer code, here is the way to format the Woocommerce billing phone: add_action('wp_footer', 'format_checkout_billing_phone'); function format_checkout_billing_phone() { if ( is_checkout() && !

Format billing phone number on WooCommerce checkout

若如初见. 提交于 2021-02-18 18:11:12
问题 For the WooCommerce checkout billing field, how can I make this field require 9 numbers and insert dashes for proper phone formatting? For example, instead of typing out 3053453212 in the phone number field, it displays: (305-345-3212) 回答1: Based on "Formatting a phone number in a form using jquery" answer code, here is the way to format the Woocommerce billing phone: add_action('wp_footer', 'format_checkout_billing_phone'); function format_checkout_billing_phone() { if ( is_checkout() && !

Format billing phone number on WooCommerce checkout

笑着哭i 提交于 2021-02-18 18:09:21
问题 For the WooCommerce checkout billing field, how can I make this field require 9 numbers and insert dashes for proper phone formatting? For example, instead of typing out 3053453212 in the phone number field, it displays: (305-345-3212) 回答1: Based on "Formatting a phone number in a form using jquery" answer code, here is the way to format the Woocommerce billing phone: add_action('wp_footer', 'format_checkout_billing_phone'); function format_checkout_billing_phone() { if ( is_checkout() && !