price

Custom product price suffix for selected product categories in Woocommerce

与世无争的帅哥 提交于 2019-12-02 00:18:01
I would like to display a piece of text after the price tag in WooCommerce. I have a code that is working for my functions.php, but it shows on all product categories. I was wondering if someone knows how to make this custom text to show for only selected categories; or even better, unselected product categories as there are a lot more product categories that will display the text than the ones who doesn't. My actual code: add_filter( 'woocommerce_get_price_html', 'custom_price_message' ); function custom_price_message( $price ) { $mt = ' per M/T'; return $price . $mt; } Any help on this

Dynamic price calculation based on custom field in Woocommerce

☆樱花仙子☆ 提交于 2019-12-02 00:10:41
问题 In Woocommerce on each product page there is a Text Box, which allows users to enter their own custom text. This text is then applied to the product, with the customer being charged on a per letter basis. I have managed to get everything working, apart from the Maths Logic. When a visitor enters x amount of letters, the current Maths logic correctly calculates the Product Price + Cost of Custom Letters and outputs this sum to the Basket Widget. Where I am running into problems, is when the

Sort a Woocommerce product variations custom output by their price

随声附和 提交于 2019-12-02 00:04:52
Bellow I have a custom shortcode function based on this answer code that displays a block of product data for both Simple products and each variation of a Variable product. The output of the variation blocks seems to be ordered by the ID of the variation itself. For example, this is a screenshot of the frontend output: Which you can see matches the order of the variation IDs (from smallest to largest) screenshot: What I would like is to sort the variations by their prices instead (NOT by their IDs) from lowest to highest. Any help is appreciated. This is the current customized code that I have

Dynamic price calculation based on custom field in Woocommerce

北城以北 提交于 2019-12-01 21:21:27
In Woocommerce on each product page there is a Text Box, which allows users to enter their own custom text. This text is then applied to the product, with the customer being charged on a per letter basis. I have managed to get everything working, apart from the Maths Logic. When a visitor enters x amount of letters, the current Maths logic correctly calculates the Product Price + Cost of Custom Letters and outputs this sum to the Basket Widget. Where I am running into problems, is when the visitor goes to the Basket Page, the Cost of the Custom Lettering is doubled. I just cannot seem to work

Omitting price property for sold products?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 13:18:48
I'm adding Schema.org (using Microdata) to a product page. My client wants the price omitted for sold products - she doesn't want anyone to be able to see the price of sold products. However this was showing up as an error in the Microdata for 'price': check page in Google SDTT Obviously the average user will still not be able to see the price, but it's used by Google Shopping so might show up. Should I just put a price of 0? It’s perfectly fine to have an Offer without a price . If Google’s Structured Data Testing Tool complains, it does not necessarily mean that you have an error in your

Copy WooCommerce products Sale prices to regular prices and reset Sale prices

北城以北 提交于 2019-12-01 12:16:02
问题 I Would like to replace all Regular prices on my WooCommerce store with the Sale Price value and delete the Sale Price values under the wp_postmeta table. The column post_id is identical for both prices for each product and the column to copy is _sale_price to _price and delete _sale_price . What query could I run to achieve this? 回答1: Here is a pure MySQL query that you are looking for: First you have to use self join to update _price and _regular_price field UPDATE `wp_postmeta` AS a, `wp

Display the default discounted price and percentage on Woocommerce products

 ̄綄美尐妖づ 提交于 2019-12-01 09:57:36
问题 I am trying to display the percentage discount of a product on Woocommerce. The solution originally provided (linked below) works, however the discount percentage doesn't display if there is a default product variation set. Only when the selection is changed to another variation does the percentage discount appear. How would I modify the code to display the percent discount immidiately - without having to select another variation? Source code: Display the discounted price and percentage on

Add a custom product calculated price to Woocommerce cart

自古美人都是妖i 提交于 2019-12-01 09:32:07
In woocommerce I have added an extra text field before add to cart button to add custom charge on product purchase. This plugin will add extra text field to single product page and calculates total plus the extra charge. My problem is that I cant add custom cart totals and the extra charge add before totals I tried woocommerce_cart_calculate_fees but no luck it only show $0 in totals PHP code: /** * Check if woocommerce is active and or installed. */ if ( class_exists( 'WooCommerce' ) || in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) )

Get the product price in Woocommerce 3

独自空忆成欢 提交于 2019-12-01 09:07:31
I'm trying to get price without currency in a function I made. function add_price_widget() { global $woocommerce; $product = new WC_Product(get_the_ID()); $thePrice = $product->get_price_html(); echo thePrice; } Displays: 100kr How do I get it to just give me the price 100 What @Syntax_Error had said is correct you have to use get_price() , WooCOmmerce also provide a wrapper function wc_get_product() for WC_Product class. So your function would look something like this: function add_price_widget() { $product = wc_get_product(get_the_ID()); $thePrice = $product->get_price(); //will give raw

Identify a value changes' date and summarize the data with sum() and diff() in R

邮差的信 提交于 2019-12-01 08:53:05
Sample Data: product_id <- c("1000","1000","1000","1000","1000","1000", "1002","1002","1002","1002","1002","1002") qty_ordered <- c(1,2,1,1,1,1,1,2,1,2,1,1) price <- c(2.49,2.49,2.49,1.743,2.49,2.49, 2.093,2.093,2.11,2.11,2.11, 2.97) date <- c("2/23/15","2/23/15", '3/16/15','3/16/15','5/16/15', "6/18/15", "2/19/15","3/19/15","3/19/15","3/19/15","3/19/15","4/19/15") sampleData <- data.frame(product_id, qty_ordered, price, date) I would like to identify every time when a change in a price occurred. Also, I would like to sum() the total qty_ordered between those two price change dates. For