woocommerce

WC_get_products Meta Query being ignored

时光怂恿深爱的人放手 提交于 2021-02-11 13:46:33
问题 Im having problems with wc_get_products meta query. Im trying to exclude products that have clearance or express in the SKU and the SKUs are formatted like so; (not my choice something the company decided many moons ago!) My Club - Express - Item My Club - Clearance - Item Another Club - Standard - Item Below are my args, please could someone tell me what's wrong with them? 'post_status' => array('publish', 'pending', 'draft', 'future', 'private'), 'parent' => array( 13, 14, 15 ), 'limit' =>

Extending a WooCommerce admin class

旧城冷巷雨未停 提交于 2021-02-11 13:00:40
问题 I'm trying to extend a WooCommerce class that concerns the Wordpress admin interface. I'm currently trying to change one of the functions inside the class by extending it. I'm attempting this: if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) { add_action('plugins_loaded', "overwrite_woocommerce"); } function overwrite_woocommerce() { class Extend_WC_Admin_Permalink_Settings extends WC_Admin_Permalink_Settings{ public function settings_save() { // Stuff that happens } } } But after

Display product prices in the local currency with a shortcode by product ID in WPML WooCommerce Multilingual

纵饮孤独 提交于 2021-02-11 12:41:58
问题 I've modified this custom code to to display products with a shortcode to create my own version which also changes the currency depending on the page language. For example: If the page is in English, the prices are displayed in British Pounds. If the page is in Spanish, the prices are displayed in EURO. Last week WPML updated their WooCommerce Multilingual plugin to enable currency depending on user location . This is what I need! For example: If the user is in United States, the prices are

Display product prices in the local currency with a shortcode by product ID in WPML WooCommerce Multilingual

妖精的绣舞 提交于 2021-02-11 12:41:31
问题 I've modified this custom code to to display products with a shortcode to create my own version which also changes the currency depending on the page language. For example: If the page is in English, the prices are displayed in British Pounds. If the page is in Spanish, the prices are displayed in EURO. Last week WPML updated their WooCommerce Multilingual plugin to enable currency depending on user location . This is what I need! For example: If the user is in United States, the prices are

Creating custom calculations using JavaScript (jQuery)

谁都会走 提交于 2021-02-11 12:26:13
问题 I wish to take the value of an HTML string contained within <bdi> tags - perform a calculation on it - and output the results in a separate <bdi> string, dependent on which input is selected on-page. The source <bdi> value changes dynamically based on user interaction, but I want to know if what I'm asking is feasible and a rough guide on how to achieve it? Screenshot to illustrate the user elements: In the DOM, the source value is nested in the below tag: <li class="grand_total"> <span class

Creating custom calculations using JavaScript (jQuery)

无人久伴 提交于 2021-02-11 12:25:09
问题 I wish to take the value of an HTML string contained within <bdi> tags - perform a calculation on it - and output the results in a separate <bdi> string, dependent on which input is selected on-page. The source <bdi> value changes dynamically based on user interaction, but I want to know if what I'm asking is feasible and a rough guide on how to achieve it? Screenshot to illustrate the user elements: In the DOM, the source value is nested in the below tag: <li class="grand_total"> <span class

How to make ship to different address checked when using Free Shipping and Flat Rate?

本秂侑毒 提交于 2021-02-11 12:01:43
问题 how can I make "Ship to a different address" checked when Free shipping or Flat rate is selected and Unchecked if Local pickup is selected. All I can see is either all 3 shipping methods are checked by default or not. Any advice would be much appreciated. Give thanks 回答1: Here is the way to show / hide checkout shipping fields (auto checking / unchecking "ship to different address" checkbox, based on the chosen shipping method. It will automatically show the shipping fields when the chosen

Update WooCommerce product price and stock

和自甴很熟 提交于 2021-02-11 06:09:45
问题 I have external REST API, from which I'm building an array like this: $arr = array( 1 => array('code' => '0100686', 'qty' => '2', 'price' => '65.22'), 2 => array('code' => '0100687', 'qty' => '1', 'price' => '5.23'), 3 => array('code' => '0100688', 'qty' => '8', 'price' => '0.28') ); After this, I need to update the price and qty of products in WooCommerce. (In above array code is SKU in WC). Afterwards my code goes following way: foreach ($arr as $single) { $product_id = wc_get_product_id_by

Update WooCommerce product price and stock

人走茶凉 提交于 2021-02-11 06:08:53
问题 I have external REST API, from which I'm building an array like this: $arr = array( 1 => array('code' => '0100686', 'qty' => '2', 'price' => '65.22'), 2 => array('code' => '0100687', 'qty' => '1', 'price' => '5.23'), 3 => array('code' => '0100688', 'qty' => '8', 'price' => '0.28') ); After this, I need to update the price and qty of products in WooCommerce. (In above array code is SKU in WC). Afterwards my code goes following way: foreach ($arr as $single) { $product_id = wc_get_product_id_by

Woocommerce - Sort products in cart by Author/User in Multi-vendor setup

♀尐吖头ヾ 提交于 2021-02-11 05:53:17
问题 I have a multivendor Woocommerce shop using Dokan plugin and I'm trying to split out the shopping cart into sections based on who the vendor is. For example: Vendor 1 Product C Product B Vendor 2 Product A Dokan uses a custom role 'vendor' to extend the user class, so to get the ID of the vendors, I should be able to use something like: $post_data = get_post( $cart_item['product_id'] ); $vendor_id = $post_data->post_author; This does work, but it will only get the first vendor ID and simply