Repository › Forums › Support › Expiry dates for WooCommerce PRO › Expiry date not displayed as expected
- This topic has 20 replies, 2 voices, and was last updated 6 years, 8 months ago by egoetschel.
-
AuthorPosts
-
July 31, 2017 at 9:28 am #1746egoetschelParticipant
In the description of the plugin the following features are described:
- Present expiry date to the customer on the product detail page, cart page and/or on the delivery note (fully customizable).
- Get an overview of products in stock that are about to expire.
At the moment only one expiry date is shown, but the whole stock.
This makes no sense, neither for stock managment nor the customer.
Have I overseen something?
July 31, 2017 at 1:44 pm #1747Soft79KeymasterHi egoetschel,
– On the product detail page the expiry date is displayed of the oldest item.
– On the cart page and in the order confirmation, the expiry date of all products is displayed (e.g. 1×2017-08-01 2×2017-09-01)What would you like to see differently?
August 2, 2017 at 9:30 pm #1759egoetschelParticipantSorry, I didn’t receive a notification, that there is an answer to my post…
In the product overview is only the expiry date of a) the oldest item without b) the number of items with this expiry date. This makes no sense to manage the stock.
On the product detail page is the expiry date of the oldest item displayed. What’s the sense of this? It’s possible that a customer also buys items with another expiry date. Further I ask myself if this is legal.
August 2, 2017 at 10:05 pm #1760Soft79KeymasterYou can change this with template override.
1) Create a new file wp-content/YOUR_CHILD_THEME/soft79-wc-expiry-dates/single-product/expiry-date.php
2) Paste this contents in the file:<?php if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! empty( $stock_items ) ): ?> <div class="soft79_wcxd_expiry_dates"> <?php if ( $expiry_date = $product_logic->getPurchasableExpiryDate() ) { echo $expiry_rule->getTitle() . ': <span class="soft79_wcxd_expiry_date">' . SOFT79_WCXD_View::formatStockItemsHtml( $stock_items ) . '</span>'; } ?> </div> <?php endif;
Now all expiry dates are displayed at the product detail page.
August 2, 2017 at 10:25 pm #1761Soft79KeymasterPS: Why wouldn’t it be legal? The expiry date is shown, and if a customer purchases more than the available amount (of the oldest items), he will receive items with a better expiry date.
August 3, 2017 at 12:10 pm #1763egoetschelParticipantThank you very much for the fix! And how can this be done for the product overview (in the backend)?
I’m happy not to be part of the EU. They have a law for everything… And with most of the WooCommerce shops something is illegal. If you want to know, if the plugin is legal you have to check it with a lawyer. Or bether add some disclaimer. Just a thought. 😉
August 3, 2017 at 12:35 pm #1764Soft79KeymasterThis can’t be done in the backend. I’m planning on implementing a better overview at the backend, but don’t have an ETA for this yet.
August 3, 2017 at 9:34 pm #1769egoetschelParticipantOkay, I understand. But it also is not possible to export the values (metadata). In my opinion this is a fault.
August 3, 2017 at 9:51 pm #1770Soft79KeymasterThe data is stored in _j79_wcxd_expiries / _j79_wcxd_expiry_date . This can be exported, but it has to be deserialized to process.
August 3, 2017 at 10:07 pm #1771egoetschelParticipantHow can it be exported? There is nothing in the exported data that can be deserialized.
August 3, 2017 at 10:29 pm #1772Soft79KeymasterIf you use this plugin: https://nl.wordpress.org/plugins/product-import-export-for-woo/
And include this filter to your functions.php:
add_filter( 'woocommerce_csv_product_post_columns', function( $arr) { $arr['_j79_wcxd_expiries'] = '_j79_wcxd_expiries'; $arr['_j79_wcxd_expiry_date'] = '_j79_wcxd_expiry_date'; return $arr; });
Now you can export the expiry dates. Please note that dates are stored as unix timestamp.
I’m not sure if import works out of the box. I’ve never tested it.
August 3, 2017 at 10:33 pm #1773egoetschelParticipantThis is really great! Thank you very much for the support!
August 4, 2017 at 2:59 pm #1774egoetschelParticipantI tried the filter, but it does not work. 🙁
The default export function shows the first data as unix timestamp (also without the filter).
The plugin Product Import Export for WooCommerce shows no data.
August 4, 2017 at 3:22 pm #1775Soft79KeymasterHow strange, are the fields displayed and checked on the export page?
August 4, 2017 at 3:31 pm #1776egoetschelParticipantSorry, my fault! The child theme was not activated in the test installation.
It works now without any problems.
-
AuthorPosts
- You must be logged in to reply to this topic.