Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @boxhamster

    The error message indicates that a DateTime object is being passed where a string is expected. I tried reprocuing the error on my end, but couldn’t.

    However, this could be due to a recent update or a conflict with another plugin or theme. You can try the following steps to resolve the issue:

    1. Deactivate all your plugins except WooCommerce to see if the error persists. If the error disappears, reactivate your plugins one by one to identify the plugin causing the conflict.
    2. Temporarily switch to a default WordPress theme like Twenty Twenty-One to check if the issue is theme-related.
    3. If the issue persists, you might need to debug it further. Enable WP_DEBUG and WP_DEBUG_LOG in your wp-config.php file. This will create a debug.log file in your wp-content directory capturing any errors or warnings. More info: https://developer.www.ads-software.com/advanced-administration/debug/debug-wordpress/

    If none of the above steps work, please get back to us with the results of these tests, and we’ll be happy to assist further.

    Thread Starter boxhamster

    (@boxhamster)

    Ahh, you’re a star!
    I was startled for a minute why that specific option disappeared when changing theme, but then looking into my them (Blocksy, Child theme), I had added this code a while ago, but it looks like it is not working anymore:
    `</p> <p>/**</p> <ul> <li>Allow redownloads for customers https://gist.github.com/bdaley/d6cdb1d52ca8011003c79e072ef02391#file-wc-regenerate-and-notify-php-L32<br>*/<br>add_filter(‘woocommerce_order_actions&#8217;, ‘wc_regenerate_and_notify_custom_order_action’);<br>function wc_regenerate_and_notify_custom_order_action( $actions ) { // Remove the woocommerce option to regenerate to avoid confusion<br>unset($actions[‘regenerate_download_permissions’]); // Add our new action (executed below)<br>$actions[‘wc_regenerate_and_notify’] = __(‘Regenerate permissions & send link to customer’, ‘wc-regenerate-and-notify’);<br>return $actions;<br>}</li> </ul> <p>/**</p> <ul> <li>We need to do 4 things:</li> <li>1) Reset the download counter</li> <li>2) Reset the download expiration date</li> <li>3) Send order confirmation (again) with the download links</li> <li>4) Add a note for recording purposes. *<br>*/<br>add_action(‘woocommerce_order_action_wc_regenerate_and_notify’, function($order){ // 1) Reset the download counter<br>$data_store = WC_Data_Store::load( ‘customer-download’ );<br>$data_store->delete_by_order_id( $order->ID );<br>wc_downloadable_product_permissions( $order->ID, true ); // 2) Retrieve Download and remove the access expiration. (Our poor customer has had enough trouble)<br>// Set the expiration date to +3 days<br>$expiration = new DateTime(‘+3 days’); $downloads = $data_store->get_downloads(array(‘order_id’ => $order->ID) );<br>if(is_array($downloads)){<br>foreach($downloads as $download){<br>$download->set_access_expires($expiration); // Use expiration date here<br>$download->save();<br>}<br>} // 3 & 4) Yay! Send an updated invoice to the customer with this message:<br>$order->add_order_note( __( “We’ve reset your download permissions. Please try downloading again.”, ‘woocommerce’ ), true, true );<br>});`

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @boxhamster,

    I had added this code a while ago, but it looks like it is not working anymore:

    Does this mean you were able to solve the issue by removing the code you had added?

    I would recommend checking if your theme is compatible with the latest version of WooCommerce.

    Thank you.

    Thread Starter boxhamster

    (@boxhamster)

    Hi
    The given code only adds some functionality in the backend, so it actually has nothing to do with the theme itself.
    I guess I need to figure out now why that code doesn’t work anymore due to a recent update of WC.
    Thanks

    Hey, @boxhamster!

    I guess I need to figure out now why that code doesn’t work anymore due to a recent update of WC.

    While we can’t provide support for code customization as per our support policy, we do our best to offer advice and direct you to appropriate resources.

    You can visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there too.

    Since you were able to find what is causing the issue, I’ll close this thread now, okay?

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.