I have a few issues with this plugin. I assume this is the place to submit bug reports and get issues resolved? I’m trying to resolve some issues with any of our customers using Woo/WPC-PQ for their ordering front-end. They’re all using the paid version of WPC-PQ.
All of our customers need to be able to enter decimal values in their order quantities, because they are primarily meat suppliers, and products are ordered by the kilo. This plugin mostly works, but there are a couple of shortcomings that I need to get resolved.
First, any AJAX post-back from the checkout page causes the cart total to recalculate, which is normal, but it also rounds a 5.5 quantity line DOWN to 5. The checkout page opens fine, shows “Product x 5.5, subtotal $55.00”. Then an “extra fees” plugin kicks in because there is a surcharge for using credit cards instead of COD. This causes an AJAX post-back to Woo to add the fee and return the new order details, “Product x 5, subtotal $50.00”. This is where the order gets rounded.
At this stage, the quantity hasn’t been modified in the database, but it DOES modify the line total stored. However, after checkout completes, the line quantity IS rounded and stored again. I haven’t figured out what is doing this second rounding.
I can’t be certain, but it is possible it was this commit in Woo, file QuantityLimits.php, line 230. It casts the result to an int, and I believe this is what causes the quantity truncation on the checkout page’s post-back. I could be entirely wrong though, as I can’t get my dev VM working the same without the premium version of WPC-PQ. https://github.com/woocommerce/woocommerce/commit/9c58f198cfb7f1413bc83775fa2d9cc5bd5775fb
Second is the WC REST API. GETting and order from the site works fine, showing the decimal quantity for the line items. However, PUTting that same order back to the site returns an “Invalid parameter(s): line_items” / “line_items[0][quantity] is not of type integer.” error. We’ve fixed this by modifying the REST schema to allow numbers in the quantity field, instead of requiring an integer. This is our code to fix it:
add_filter( 'woocommerce_rest_shop_order_schema', 'wc_enable_decimal_quantities_api_modify_schema', 999 );
function wc_enable_decimal_quantities_api_modify_schema( $properties ) {
$properties['line_items']['items']['properties']['quantity']['type'] = 'number';
return $properties;
}
I’d like to see this fix incorporated into WPC-PQ so we don’t have to deploy this code to customer’s sites when we integrate our production systems with their ordering sites.
I’d love to be able to investigate these issues further and find the exact causes to report, but none of our customers are willing to pay the hourly fee for a senior dev to troubleshoot so deeply when the customer believes “it should just work!”
Thank you for the excellent plugin.
It appears that the plugin currently does not support payments in decimal format. For instance, I’m unable to check out with amounts like 225.35. Could you please implement this feature, or let me know which code I need to modify to allow cents in the input box?
Once again, thank you for the plugin. I look forward to your response.
Best regards,
Mahadi
link gambar
https://drive.google.com/drive/folders/1-Oa5jX8o9OcCHJsGTV2QyP8HqKYCZiuE?usp=sharing
In “datatables.net” I have found this solution:
{
?extend: 'excel',
????? exportOptions: {
??????????columns: ':visible',
??????????format: {
???????????body: function(data, row, column, node) {
??????????????data = $('<p>' + data + '</p>').text();
??????????????return $.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;
??????????????}
?????????? }
????? ?}
}
But I’d need to know how it would work in my code:
{
"extend": "excelHtml5",
"text": "EXCEL",
"exportOptions": {
"modifier" : {
"order" : "current",
"page" : "all",
"search" : "applied"
}
}
}
Is there a way to export what you see on the web to excel?
Thanks
Best regards.
Agruquero.
function pw_rcp_custom_currency( $currencies ) {
$currencies['IDR'] = 'Indonesian Rupiah (Rp.)';
return $currencies;
}
function ag_rcp_idr_currency_filter_before($formatted_price, $currency_code, $price) {
return 'Rp'. ' '.$price;
}
function ag_rcp_idr_currency_filter_after($formatted_price, $currency_code, $price) {
return $price.' '.'IDR';
}
add_filter( 'rcp_currencies', 'pw_rcp_custom_currency' );
add_filter( 'rcp_idr_currency_filter_after', 'ag_rcp_idr_currency_filter_after', 10, 3 );
add_filter( 'rcp_idr_currency_filter_before', 'ag_rcp_idr_currency_filter_before', 10, 3 );
I have pasted the code above in (functions.php) and it worked.
But that’s not true,How to change Rp 100000 to Rp 100.000