1. From the back end to duplicate any order, while picking the latest prices of cause.
2. From the customers/front end to click to “Order Again”
We are using pricing per country, AffiliateWP Rank and group pricing and any cloned order should of cause include their own prices and discounts. This may happen automatically, that we don’t know..
]]>Expected behaviour:
Customer buys $100 product with $20 add-on, pays $120 and completes the order. When clicking on order again, the same product and same add-on should be added to cart, totalling to $120.
Actual behaviour:
Customer buys $100 product with $20 add-on, pays $120 and completes the order. When clicking on order again, the same product is added to cart, WITHOUT add-ons, totalling to $100.
Is there a way to force the add-on to be re-applied when using the order again functionality?
]]>https://drive.google.com/file/d/1CPKjssmvcnW_b5CdgJc6gqLYQ3RNgFS1/view?usp=sharing
]]>I need to calculate prices based on the weight of the product. I’ve successfully implemented this using the following filter:
add_filter( 'woocommerce_add_cart_item', 'set_custom_cart_item_prices', 20, 2 );
function set_custom_cart_item_prices( $cart_data, $cart_item_key ) {
// Price calculation
if ($cart_data['data']->get_weight()) {
$new_price = $cart_data['data']->get_price() * ($cart_data['data']->get_weight()/1000);
// Set and register the new calculated price
$cart_data['data']->set_price( $new_price );
$cart_data['new_price'] = $new_price;
}
return $cart_data;
}
In the archive-product.php file, I show the users last order and allow them to add all items from this order to the cart using the following code:
<?php
if (!is_product_category()) {
if ($last_order) {
$products = $last_order[0]->get_items();
?>
<section class="last-order">
<h3>Laatste bestelling</h3>
<section>
<ul>
<?php
foreach ($products as $product) {
?>
<a href="<?php the_permalink($product['product_id']); ?>">
<li>
<p class="name"><span class="quantity"><?php echo $product->get_quantity(); ?>x</span> <?php echo $product->get_product()->get_name(); ?></p>
<p class="price"><?php echo wc_price($product->get_quantity() * $product->get_product()->get_price()); ?></p>
</li>
</a>
<?php
}
?>
</ul>
</section>
<div class="wp-block-button wp-block-button-width">
<a class="wp-block-button__link" href="<?php echo wp_nonce_url( add_query_arg( 'order_again', $last_order[0]->get_id() ) , 'woocommerce-order_again' ); ?>">Voeg toe aan winkelwagen<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/icon-arrow-right.svg"/></a>
</div>
</section>
I noticed that using this functionality results in incorrect prices in the cart. That’s why I tried to solve it using the following code:
add_filter( 'woocommerce_add_order_again_cart_item
', 'set_custom_order_again_cart_item_prices', 20, 2 );
function set_custom_order_again_cart_item_prices( $cart_data, $cart_item_key ) {
// Price calculation
if ($cart_data['data']->get_weight()) {
$new_price = $cart_data['data']->get_price() * ($cart_data['data']->get_weight()/1000);
// Set and register the new calculated price
$cart_data['data']->set_price( $new_price );
$cart_data['new_price'] = $new_price;
}
return $cart_data;
}
Unfortunately, this doesn’t work. Does anyone know if the filter I’m using is wrong? Or if there’s a better way to calculate prices based on weight? I’d highly appreciate it if anyone could have a look!
Thanks in advance,
Quinten
At the Checkout page there is a button “order again”. As I sell a digital service and not a product, I don’t want that button on my page.
I googled around but the only way I can find is to add some code to a functions.php. Isn’t there a easier way to do this?
For me the best way would be a setting to turn this on or off. Maybe something for the nearby future?
Regards,
Jeroen
I checked your website at this page:
https://najeebmedia.com/wordpress-plugin/woocommerce-personalized-product-option/
It says we can add price in % also.
But i can never manage this. only net price is possible.
Anyone can help me?
]]>We have a child theme and can write something in the functions.php to remedy this, but I’m unsure what is the preferred method of doing so.
It would be best if the plugin itself handled this, but I would at least like guidance on how to fix this myself.
]]>I am currently using the latest version woocommerce 3.3.5 and I am wondering is there a way to let my previous customers place repeat order easier? Does woocommerce has such a feature?
Any help will be appreciated, thank you.
]]>Thank you.
https://www.ads-software.com/plugins/wc-fields-factory/
]]>