Repository Forums Support Expiry dates for WooCommerce PRO Expiry date not displayed as expected

Topic Resolution: Resolved
Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #1746
    egoetschel
    Participant

    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?

    #1747
    Soft79
    Keymaster

    Hi 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?

    #1759
    egoetschel
    Participant

    Sorry, 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.

    #1760
    Soft79
    Keymaster

    You 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.

    #1761
    Soft79
    Keymaster

    PS: 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.

    #1763
    egoetschel
    Participant

    Thank 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. 😉

    #1764
    Soft79
    Keymaster

    This 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.

    #1769
    egoetschel
    Participant

    Okay, I understand. But it also is not possible to export the values (metadata). In my opinion this is a fault.

    #1770
    Soft79
    Keymaster

    The data is stored in _j79_wcxd_expiries / _j79_wcxd_expiry_date . This can be exported, but it has to be deserialized to process.

    #1771
    egoetschel
    Participant

    How can it be exported? There is nothing in the exported data that can be deserialized.

    #1772
    Soft79
    Keymaster

    If 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.

    #1773
    egoetschel
    Participant

    This is really great! Thank you very much for the support!

    #1774
    egoetschel
    Participant

    I 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.

    #1775
    Soft79
    Keymaster

    How strange, are the fields displayed and checked on the export page?

    #1776
    egoetschel
    Participant

    Sorry, my fault! The child theme was not activated in the test installation.

    It works now without any problems.

Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.