kkarpieszuk / wc-price-history

Track Woocommerce Products prices history and display the lowest price in the last 30 days. This plugin allows your WC shop to be compliant with European Commision Directive 98/6/EC Article 6a which specyfies price reduction annoucment policy.
MIT License
6 stars 4 forks source link

Add shortcode #4

Closed kkarpieszuk closed 1 year ago

kkarpieszuk commented 1 year ago

with attribute for product id


Hint: Are you waiting for the same feature to be implemented? Please react with ❤️ to this issue description (features with more reactions will get higher priority)

Kubeec108 commented 1 year ago

Hi, I just downloaded your plugin, and unfortunately, it's not working on my product page because I am using a theme that is probably incompatible with your plugin. I can edit product page manually with a plugin I am using but I need a shortcode of your plugin. I tried [wc_price_history] but it's not working. Are you planning to make it work? Thank you for your update!

kkarpieszuk commented 1 year ago

this fix is not merged yet (you can see this looking on the right sidebar here, and there is green icon with two arrows which are not connected yet) not released.

for time being you can try to use this code to show price:

$storage = new \PriorPrice\HistoryStorage();
echo $storage->get_minimal( $product_id );

in place of $product_id of course provide the product ID

Kubeec108 commented 1 year ago

Thank you! Since I am not coder and I don't really know what to do with the code you provided. I will wait for the shortcode. Thank you :)

kkarpieszuk commented 1 year ago

@Kubeec108 it is merged now and will be released today if I didn't make any troubles :) Please look for 1.2 release in your wp admin.

when updated, you will be able to use this shortcode as follows:


If you want to display the lowest products price in other place than default, you can use shortcode wc_price_history. A few examples:

Display the lowest price on single product page (without passing product ID as argument), currency symbol attached:

This product low is [wc_price_history]

Display the lowest price of the other product, currency symbol attached:

The product with ID 3 had the lowest price [wc_price_history id=3]

Display without currency symbol:

The product with ID 3 had the lowest price [wc_price_history id=3 show_currency=0]
Kubeec108 commented 1 year ago

Thank you for amazing work!