woocommerce

Shipping options depending on cart weight and shipping class

蓝咒 提交于 2021-02-08 07:51:18
问题 I am working on a WordPress site that uses WooCommerce. I found this piece of code that allows me to set a freight shipping option based on weight. It worked great until the client also wanted the same freight shipping option if a freight shipping class is selected on a product. add_filter( 'woocommerce_package_rates', 'bbloomer_woocommerce_tiered_shipping', 10, 2 ); function bbloomer_woocommerce_tiered_shipping( $rates, $package ) { if ( WC()->cart->cart_contents_weight < 300 ) { if ( isset(

Shipping options depending on cart weight and shipping class

随声附和 提交于 2021-02-08 07:51:05
问题 I am working on a WordPress site that uses WooCommerce. I found this piece of code that allows me to set a freight shipping option based on weight. It worked great until the client also wanted the same freight shipping option if a freight shipping class is selected on a product. add_filter( 'woocommerce_package_rates', 'bbloomer_woocommerce_tiered_shipping', 10, 2 ); function bbloomer_woocommerce_tiered_shipping( $rates, $package ) { if ( WC()->cart->cart_contents_weight < 300 ) { if ( isset(

Shipping options depending on cart weight and shipping class

眉间皱痕 提交于 2021-02-08 07:50:32
问题 I am working on a WordPress site that uses WooCommerce. I found this piece of code that allows me to set a freight shipping option based on weight. It worked great until the client also wanted the same freight shipping option if a freight shipping class is selected on a product. add_filter( 'woocommerce_package_rates', 'bbloomer_woocommerce_tiered_shipping', 10, 2 ); function bbloomer_woocommerce_tiered_shipping( $rates, $package ) { if ( WC()->cart->cart_contents_weight < 300 ) { if ( isset(

Woocommerce Setup Failed

我的未来我决定 提交于 2021-02-08 07:40:28
问题 I tried to install woocommerce on a fresh WordPress 5.4.1 installation. Woocommerce plugin was successfully installed, but when setting up the store, there's an error, it says There was a problem updating your preferences , I checked the browser console, and from the ajax call it received : {"code":"woocommerce_rest_cannot_view","message":"You must supply an array of options.","data":500} I tried to remove the application folder and database, then recreated a new empty database then reinstall

Woocommerce Setup Failed

╄→尐↘猪︶ㄣ 提交于 2021-02-08 07:39:56
问题 I tried to install woocommerce on a fresh WordPress 5.4.1 installation. Woocommerce plugin was successfully installed, but when setting up the store, there's an error, it says There was a problem updating your preferences , I checked the browser console, and from the ajax call it received : {"code":"woocommerce_rest_cannot_view","message":"You must supply an array of options.","data":500} I tried to remove the application folder and database, then recreated a new empty database then reinstall

Hiding order status in My Account recent orders list page

帅比萌擦擦* 提交于 2021-02-08 07:34:46
问题 In WooCommerce, I have a Woocommerce site and on the customer's recent orders page, there is a table with order details on this example link: https://example.com/my-account/view-order/ I would like to completely hide order status from the table if possible. How can I achieve this? Thanks 回答1: Updated: Just use this custom function hooked in woocommerce_my_account_my_orders_columns filter hook: add_filter('woocommerce_my_account_my_orders_columns', 'custom_removing_order_status', 10, 1);

Adding recipients to Woocommerce email notifications based on product variation term

旧街凉风 提交于 2021-02-08 07:32:34
问题 I have created a Woocommerce plugin and require it to do two things: Send a notification message to a specific email address, based on which product variation is in the cart. The email must contain only the relevant product, and not products that contain other attributes. For example: Product A has an Attribute named Chef, with chef-one and chef-two as variable Terms. The user may select Product A from chef-one or chef-two. If the user selects Product A from chef-one, a notification email

Auto set specific attribute term value to purchased products on Woocommerce

痴心易碎 提交于 2021-02-08 06:58:18
问题 I want to automatically add a specific attribute value (which was previously set up) to ordered products when the order is placed and has "on-hold" status. I sell unique products and I have set up the "STOCK" attribute and the "Out Of Stock" (out-of-stock) value. When an order is placed and has "on-hold" status, I want to automatically change the featured status of the ordered products and also to add the out-of-stock attribute value to it. The featured part is done and works, but I can't

Set a min unit displayed price for simple products too in Woocommerce

故事扮演 提交于 2021-02-08 06:44:28
问题 In Woocommerce I would like to show a minimum price for a simple product and variable products in front of the catalog. Based on "Set a min unit displayed price for variable products in Woocommerce" answer code, where I have made light changes to the last function as follow: // Frontend: Display the min price with "From" prefix label for variable products add_filter( 'woocommerce_variable_price_html', 'custom_min_unit_variable_price_html', 30, 2 ); function custom_min_unit_variable_price_html

Pre populate Woocommerce checkout fields

时间秒杀一切 提交于 2021-02-08 06:33:48
问题 I am trying to pre-populate additional fields in the woocommerce checkout page but I am struggling with it. add_filter('woocommerce_checkout_get_value', function($input, $key ) { global $current_user; switch ($key) : case 'billing_first_name': case 'shipping_first_name': return $current_user->first_name; break; case 'billing_last_name': case 'shipping_last_name': return $current_user->last_name; case 'billing_phone': return $current_user->phone; break; case 'billing_company': case 'shipping