woocommerce

Sorting order items via a hooked function in WooCommerce

…衆ロ難τιáo~ 提交于 2021-02-10 14:42:04
问题 In WooCommerce, I have a product attribute pa_location for "location" with which I sort my order items. When order items have the same location, I'd like to sort them by SKU. So, sort first by location and then by SKU. I looked to "PHP usort sorting multiple fields" but I am unable to figure out how it applies and would work for my function. I have this custom function that works to sort by pa_location , but cannot get it to also sort by _sku . I tried implementing some of the examples in the

Display the product attribute term for the selected variation in Woocommerce

痴心易碎 提交于 2021-02-10 14:41:24
问题 In Woocommerce, I use the following code to get the product attribute terms. function action_woocommerce_product_meta_end() { global $product; $term_ids = wp_get_post_terms( $product->get_id(), 'pa_apple-id', array('fields' => 'ids') ); echo get_the_term_list( $product->get_id(), 'pa_apple-id', '<span class="posted_in">' . _n( 'Vendor:', 'Vendors:', count( $term_ids ), 'woocommerce' ) . ' ', ', ', '</span>' ); } add_action( 'woocommerce_product_meta_end', 'action_woocommerce_product_meta_end'

Sorting order items via a hooked function in WooCommerce

守給你的承諾、 提交于 2021-02-10 14:39:03
问题 In WooCommerce, I have a product attribute pa_location for "location" with which I sort my order items. When order items have the same location, I'd like to sort them by SKU. So, sort first by location and then by SKU. I looked to "PHP usort sorting multiple fields" but I am unable to figure out how it applies and would work for my function. I have this custom function that works to sort by pa_location , but cannot get it to also sort by _sku . I tried implementing some of the examples in the

Get specific product attribute name and value for each WooCommerce variation of a variable product

我的梦境 提交于 2021-02-10 14:36:39
问题 In WooCommerce, I would like to display variable products with my own custom design as a carousel of product variations. I got the code by which I can display the regular price of the product in array but I stuck in getting attribute name and value in that. Based on "WooCommerce variable products: Display some variations values in an HTML table" answer code, here is my actual code: add_action( 'woocommerce_before_single_product_summary', 'custom_table_after_single_product' ); function custom

Change specific shipping method title on WooCommerce orders after checkout

不羁岁月 提交于 2021-02-10 14:35:27
问题 I have some custom fields in my shipping information that is not being displayed "properly" in the shipping information of orders under woocommerce -> orders -> order#. The cart and checkout pages are different via php code that changes a label. The cart image1 is the original\core label that is defined in shipping methods image2, this is being sent to the order information page. I would like the checkout information to show instead which is shown in image3. Image4 is how it currently looks

How to prevent `out of stock` items to show as a filter option in the sidebar (layered nav widget ) in WooCommerce?

泄露秘密 提交于 2021-02-10 14:19:41
问题 I have 'hide out of stock' checked in the settings, however when using the layered navigation widget to filter results by shoe size, it is returning products which have that size listed as an attribute, but the size is out of stock. Is there a fix to this? WordPress version 3.9.1, WooCommerce version 2.1.7 http://www.foten.se 回答1: He means not showing the products in the filter results. If a user filters by size M, he wants to see available size M products in the results, not All products

Adding Additional Currrencies to Product Price using wc_price Filter Hook

懵懂的女人 提交于 2021-02-10 14:18:25
问题 Based on the answer from my original post A non well formed numeric value encountered while using wc_price WooCommerce hook, I am now trying to add additional currencies to the function and finally, output them all. I decided to go with a DIV-section of four columns whereof the CSS makes it responsive. .exchanged-price{ float: left; width: 25%; padding: 15px; } .exchange-rate-wrapper:after{ content: ""; display: table; clear: both; } @media screen and (max-width: 900px){ .exchanged-price{

Add a custom field to an order in WooCommerce 3+

十年热恋 提交于 2021-02-10 14:18:02
问题 In WooCommerce, I would like to add a new custom field to order details. I now that I can use use the code below to create a new custom field 'referenceNumber' and adds in it "ordercreated" value: update_post_meta($order_id, 'referenceNumber', 'ordercreated']); What I would like is to make that through checkout once an order is placed. But it doesn't work it doesn't add a new custom field to order details page and don't add the value 'ordercreated', as you can see in this screenshot: So the

Set specific taxable shipping rate cost to 0 based on cart subtotal in WooCommerce

喜夏-厌秋 提交于 2021-02-10 12:49:28
问题 With following code I'm able for specific shipping rate method (here 'easypack_parcel_machines') to set the cost to 0, when cart subtotal is up to a specific amount (here 150 PLN) : function override_inpost_cost( $rates, $package ) { // Make sure paczkomaty is available if ( isset( $rates['easypack_parcel_machines'] ) ) { // Current value of the shopping cart $cart_subtotal = WC()->cart->subtotal; // Check if the subtotal is greater than 150pln if ( $cart_subtotal >= 150 ) { // Set the cost

Set specific taxable shipping rate cost to 0 based on cart subtotal in WooCommerce

守給你的承諾、 提交于 2021-02-10 12:47:57
问题 With following code I'm able for specific shipping rate method (here 'easypack_parcel_machines') to set the cost to 0, when cart subtotal is up to a specific amount (here 150 PLN) : function override_inpost_cost( $rates, $package ) { // Make sure paczkomaty is available if ( isset( $rates['easypack_parcel_machines'] ) ) { // Current value of the shopping cart $cart_subtotal = WC()->cart->subtotal; // Check if the subtotal is greater than 150pln if ( $cart_subtotal >= 150 ) { // Set the cost