We use the standard coupon module from WC.
When applying a simple coupon amount, the total discount in the order is calculated down to the individual order items and displayed as a discount for each order item line.
https://ibb.co/Zz3fvbv
Is it possible to prevent the line-by-line calculation and to only display the applied coupon amount below the item subtotal?
Thank you for a helpful hint.
I’m curious about how WooCommerce distributes coupons within order items. I’ve generated a fixed cart coupon for $100.
However, when I apply this coupon to an order, I’ve noticed that the coupon amount is divided among the order’s line items. I’m unclear about the logic WooCommerce uses to distribute the coupon amount. Is there a specific formula or method involved in this distribution process?
I also needed this, so I have created a small plugin to extend the WooCommerce Order admin page allowing users to reorder (rearrange) the products.
Further Info here:
https://www.ads-software.com/plugins/wc-rearrange-order-items/
Feel free to use
]]>i was trying to loop throw order items and set some data in in order item meta along with some custom data insertion to a custom table with the snippet bellow.
but WC_Order_Item_Product::get_id() or WC_Order_Item::get_id() return zero.
also the items array key indicates that the line item is not saved.
add_action( 'woocommerce_checkout_order_processed', function( $order_id, $posted_data, $order ) {
$order = wc_get_order( $order_id );
$items = $order->get_items( 'line_item' );
if ( ! empty( $items ) ) {
foreach ( $items as $item_id => $item ) {
// here i'm getting 0 return from the get_id method.
$order_item_id = $item->get_id();
// and also, the $item_id is new:line_items0
}
}
}, 100, 3 );
But if i use the woocommerce_before_thankyou
hook then it works.
Is there any way to display ‘total quantity of ordered items’ on the order details page and in email as well?
Screenshot: https://paste.pics/BRCXN
I tried different plugins and code but not working.
Thank you
Naima
]]>Any help appreciated,
]]>This piece works, but does not sort the products by location. Everytime I try something I end up with an empty or weird looking order-email:
` <table border=1px;>
<tr>
<td>Locatie</td>
<td>Naam</td>
<td>Gewicht</td>
<td>Aantal</td>
<td>Barcode</td>
</tr>
<?php
// Loop though order line items
foreach ($order->get_items() as $item_id => $item ) {
?>
<tr>
</td>
<?php
// Get the WC_Product Object instance
$product = $item->get_product();
$productlocation = $product->get_attribute(‘locatiecode’);
echo $productlocation;
?>
</td><td>
<?php
// PRODUCT NAME
$product_name = $item->get_name();
echo $product_name;
?>
</td>
<td>
<?php
// Get the WC_Product Object instance
$weight = $product->get_weight();
if($weight == 0){
echo ” “;
} elseif($weight < 1){
$_weightstr = number_format($weight*1000,0) . ”
Gram”;
}else {
$_weightstr = number_format($weight, 1, ‘,’, ”) . ” Kilo”;
}
if ( $product->has_weight() ) {
echo ‘<div class=”product-meta”>’ . $_weightstr . ‘</div>
</br>’;
}
?>
</td>
<td>
<?php
// PRODUCT QUANTITY
$quantity = $item->get_quantity();
echo $quantity;
?>
</td>
<td>
<?php
$productbarcode = $product->get_attribute(‘barcode’);
echo $productbarcode;
?>
</td>
</tr>
<?php
}
?>
</table>’
Is there a way we can send actual order items to Payfast? Instead of just having the blog name, order id and payment Total?
]]>See screenshots of the before and after:
Before upgrade:
https://awesomescreenshot.com/0c760m0oad
After upgrade:
https://awesomescreenshot.com/03660m0c16
This has happened to each website I have updated to the latest version. Was it purposely removed or is there some other issue? A lot of useful Actions were in the dropdown menu.
https://www.ads-software.com/plugins/woocommerce/
]]>