petermorlion
Forum Replies Created
-
Forum: Plugins
In reply to: [SEPA QR-Code for Woocommerce] Email integrationHi @sveltamelsele !
Thanks for using the plugin. I have some questions though:
- does the QR code show after the checkout (so on the thank you page)?
- have you set the setting to store the generated QR codes as PNG files? Because some email clients won’t show Base64 encoded images
In essence, this plugin just adds something after the order table. It does so by using a WooCommerce hook. I’d have to look into it, but another plugin shouldn’t be removing that, in my opinion.
Let me know the answers to the questions above and I’ll look into it further.
Found it right after posting this. The message about the SG Optimizer plugin helped:
There is active the?SG Optimizer?plugin. If the forms are not visible, please, follows the steps below:
- Go to the menu option: “SG Optimizer > Frontend”
- Enter in the “JAVASCRIPT” tab
- Select the jQuer path through the “Exclude from Deferral of Render-blocking JS”
- Purge the “SG Cache”
I didn’t have to purge the cache.
Forum: Plugins
In reply to: [WooCommerce] Add datepicker to order preview for payment dateIn the end, I added it with the code below. Basically, it adds a datepicker to the preview template with the
woocommerce_admin_order_preview_end
hook. To set the value, I must also add the value to the array of data that will be used in the template. For that, I hook into thewoocommerce_admin_order_preview_get_order_details
filter. Because the datepicker needs to be initialized when the modal popup appears, I use theload-edit.php
to add some custom JavaScript to react to the modal showing. Finally, I added AJAX functionality withwp_ajax_woocommerce_farm_manager_update_date_paid
so that I can send an AJAX request to the server when the value in the datepicker changes.add_filter('woocommerce_admin_order_preview_end', array(__CLASS__, 'add_date_paid_datepicker_to_preview_template'), 10); add_filter('woocommerce_admin_order_preview_get_order_details', array(__CLASS__, 'order_preview_get_order_details'), 10, 2); add_action('load-edit.php', array(__CLASS__, 'on_load_edit'), 10); add_action('wp_ajax_woocommerce_farm_manager_update_date_paid', array(__CLASS__, 'update_date_paid_ajax')); ... /** * Add a formatted date to the array that will be used in the order preview template. */ public static function order_preview_get_order_details($result, $order) { $date_paid = get_post_meta($order->get_id(), '_date_paid', true); //timestamp $formatted_date_paid = $date_paid ? date('Y-m-d', intval($date_paid + (get_option('gmt_offset') * 3600))) : ''; $result['formatted_date_paid'] = $formatted_date_paid; return $result; } /** * Add date paid datepicker to order preview template. */ public static function add_date_paid_datepicker_to_preview_template() { echo ' <div class="order-preview-date-paid-wrapper"> <table class="order-preview-date-paid-table"> <tr> <td>'; woocommerce_wp_text_input( array( 'id' => '_date_paid', 'label' => __('Date paid:', 'myplugin), 'placeholder' => 'YYYY-MM-DD', 'wrapper_class' => 'form-field-wide', 'class' => 'date-picker', 'style' => 'width: 100%', 'value' => '{{ data.formatted_date_paid }}', 'custom_attributes' => array( 'data-order-id' => '{{ data.data.id }}' ) ) ); echo ' </td> <td> <img src="' . MYPLUGIN_BASE_URL . 'assets/wpspin-2x.gif" class="date-paid-spinner" style="width: 16px; margin-top: 26px; display: none;"/> </td> </tr> </table> </div> '; } /** * Add script to retrigger datepicker initialization when modal is shown. * This is necessary because our datepicker is inside a template. */ public static function on_load_edit() { add_filter('views_edit-shop_order', function () { $post_type = get_current_screen()->post_type; if ($post_type !== 'shop_order') { return; } $nonce = wp_create_nonce('myplugin-order-preview-date-paid-nonce'); ?> <script type="text/javascript"> jQuery(document).ready(function($) { $(document.body).on('wc_backbone_modal_loaded', function() { $(document.body) .trigger('wc-init-datepickers'); $('.order-preview-date-paid-table #_date_paid').on('change', function() { var datePaid = $(this).val(); var orderId = $(this).data('orderId'); $('.date-paid-spinner').show(); $.post('<?php echo admin_url('admin-ajax.php') ?>', { action: 'woocommerce_farm_manager_update_date_paid', date_paid: datePaid, _ajax_nonce: '<?php echo $nonce; ?>', order_id: orderId }, function(response) { $('.date-paid-spinner').hide(); if (!response.success) { alert('<?php _e('There was a technical error. You can try again, but we will also investigate and fix this issue.', 'myplugin') ?>'); } }); }); }); }); </script> <?php }); } /** * AJAX endpoint to update date paid from the order preview modal. */ public static function update_date_paid_ajax() { try { check_ajax_referer('myplugin-order-preview-date-paid-nonce'); $order_id = intval($_POST['order_id']); $date_paid = sanitize_text_field($_POST['date_paid']); $order = wc_get_order($order_id); if (!$order) { wp_send_json_error(); } $order->set_date_paid($date_paid); $order->save(); wp_send_json_success(); } catch (Exception $e) { error_log($e->getMessage()); wc_get_logger()->error("UpdateDatePaid :: An exception was raised: " . $e->getMessage(), array('source' => 'wfm')); wp_send_json_error( array( "error" => $e ) ); } }
- This reply was modified 1 year, 3 months ago by petermorlion.
Forum: Plugins
In reply to: [WooCommerce] Add datepicker to order preview for payment dateHi Saif,
Thanks for answering. I may not have made myself clear enough. I was referring to the preview you get when you go to the list of orders in the admin section and click the “eye” icon in the list. Instead of clicking through to the details of the order, you get a dialog with some details.
Forum: Plugins
In reply to: [WooCommerce] Order accidentally marked as complete (manually)Ok, it seems there was a conflict with a plugin. Updating that plugin fixed it. Thank you!
Forum: Plugins
In reply to: [WooCommerce] Order accidentally marked as complete (manually)That’s what I tried but it doesn’t work. I double checked with another site and there it works. So it must be a plugin blocking this, I think. At least now I know I should investigate further. Thanks.
Forum: Plugins
In reply to: [WooCommerce] wc_get_orders for specific product typesI’m sorry, but the second reply isn’t an answer to my question as I stated I want to move away from custom SQL and use the WooCommerce API, in order to be future-proof if their schema changes.
And are you sure your first reply works? I’m getting results that shouldn’t be in there so it isn’t filtering them. Which makes sense because the product id’s aren’t part of the order meta data, but rather of the order item meta data.
Forum: Plugins
In reply to: [WooCommerce] 7.70 triggers fatal errorHad a similar issue. My error was:
Fatal error: Trait ‘Automattic\WooCommerce\RestApi\Utilities\SingletonTrait’ not found in /home/customer/www/tschaaphof.be/public_html/wp-content/plugins/user-registration-plugin-for-woocommerce/includes/rest-api/Server.php on line 18
So it seems the User Registration For WooCommerce plugin (https://woocommerce.com/products/user-registration-for-woocommerce/) no longer works now. With WooCommerce 7.6.1, it worked. So it seems 7.7.0 introduces a breaking change?
I then uploaded Woo 7.6.1 again. Deactivated the User Registration plugin, updated Woo to 7.7.0 and activated the User Registration plugin again. It didn’t produce the error anymore.
- This reply was modified 1 year, 10 months ago by petermorlion.
Totally understand. Thanks for offering help. When I find the time to decently investigate the issue and when I have more useful info, I’ll file a bug on GitHub.
So we let a user log in and check the box to receive the newsletter. But nothing changed. I didn’t see anything in the logs either. I’m still investigating and will let you know what I find.
I’ve asked my client to ask one of their customers to do a test, as my most recent test seemed to work. But I want to verify with them. I’ll let you know when I know more.
Forum: Plugins
In reply to: [Mailchimp for WooCommerce] Translations for 2.8.0It is fixed in 2.8.1 now.
Hi, thanks for answering and sorry for the late reply. I don’t know of any of my plugins interacting with Mailchimp. I’ll do some more investigating and use some totally new email addresses to be sure. I’ll let you know if I learn more.
Cool, thanks. If you want, I can create a GutHub issue. Just let me know if that makes it easier for you.
- This reply was modified 2 years ago by petermorlion.
Flushing the cache had no effect. The user are still “non-subscribed”. To make matters worse, the changes in the database have been reverted, i.e. the “mailchimp_woocommerce_is_subscribed” usermeta field was 1 (I verified this) but now is 0 again.
So the sync is going from Mailchimp back into WordPress/Woocommerce?