Welcome to our Support Portal › Forums › WooCommerce Personalized Product Options Manager (PPOM) › Ajax issues
- This topic has 8 replies, 2 voices, and was last updated 1 year, 9 months ago by
nmedia.
-
AuthorPosts
-
April 10, 2019 at 2:16 pm #11192
Lievelabels.nl
ParticipantWhen PPOM plugin is enabled, I have issues with the following AJAX call:
../wp-admin/admin-ajax.php?action=tikkie-create-order
add_action( 'wp_ajax_tikkie-create-order', 'tk_create_order' );
This always returns 0 as the function is not actually called!When I disable PPOM, it works without issues.
What could it be?April 10, 2019 at 3:33 pm #11202nmedia
KeymasterHi,
well it does not make any sense to me that PPOM will stop any ajax call …
the only reason could be function
tk_create_order
is defined again in PPOM, which is never the case.April 11, 2019 at 7:34 am #11209Lievelabels.nl
ParticipantYou are correct…. the function is called……. I need to check whats going on here…..
Added:
The function is only called, when no PPOM META is attached to the product.
Investigating further….-
This reply was modified 1 year, 9 months ago by
Lievelabels.nl.
April 11, 2019 at 9:16 am #11212Lievelabels.nl
ParticipantIt seems one of the issues is the following:
echo '<input type="hidden" name="action" value="ppom_ajax_validation">';
April 11, 2019 at 11:12 am #11213Lievelabels.nl
ParticipantAlso, when we run:
$order_id = $checkout->create_order($checkout->get_posted_data());
from our ajax function,
We have output, like somewhere PPOM is echoing some data
Depending on the PPOM meta, it outputs several “0”In our AJAX we return JSON, but depending on the amount of META, it is preceded by 0(‘s).
example:
`000{“checkoutUrl”:”https://URL”,”orderToken”:”XXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX”}April 11, 2019 at 11:18 am #11214Lievelabels.nl
Participantok, I have found the issue where the 0 is coming from:
in wp-content/plugins/woocommerce-product-addon/inc/woocommerce.phpI see here some output, which causes problems:
echo $item->get_id();
function ppom_woocommerce_order_item_meta($item, $cart_item_key, $values, $order) { if ( ! isset ( $values ['ppom']['fields'] )) { return; } // ADDED WC BUNDLES COMPATIBILITY if ( function_exists('wc_pb_is_bundled_cart_item') && wc_pb_is_bundled_cart_item( $values )) { return; } $ppom_meta = ppom_make_meta_data( $values, 'order' ); // ppom_pa($ppom_meta); exit; foreach( $ppom_meta as $key => $meta ) { echo $item->get_id(); $item->update_meta_data($key, $meta['value']); } // Since 15.2, saving all fields as another meta $item->update_meta_data('_ppom_fields', $values ['ppom']); }
-
This reply was modified 1 year, 9 months ago by
Lievelabels.nl.
April 11, 2019 at 2:07 pm #11216Lievelabels.nl
Participantin render-fields.php
// Hidden input for validation callback echo '<input type="hidden" name="action" value="ppom_ajax_validation">';
Is this really needed? Or is this residu of old coding?
April 12, 2019 at 9:16 am #11226Lievelabels.nl
Participant@nmedia, can you please update me on above?
April 13, 2019 at 4:58 pm #11244nmedia
KeymasterHi,
Thanks for identifying all these, we have fixed all above issue in version 17.2, it will be released soon. 🙂
-
This reply was modified 1 year, 9 months ago by
-
AuthorPosts
- The topic ‘Ajax issues’ is closed to new replies.