I am having a problem with the following:
I use "TM extra product options" to add some extra options when buying a product. For example:
Box of chocolate (€40,00)
Extra decorations (extra option) (€15,00)
I offer free shipping on orders above €50,00. The problem is, that the extra fees are calculated AFTER the subtotal, and the shipping is calculated based on this subtotal. In the example above, you still have to pay for the shipping, which i don't want to.
How can I make sure the fee is calculated inside the subtotal (but still mentioned as seperated product) of have the shipping calculated based on the subtotal+fees?
Thanks in advance!
PS:
Something along this way:
$woocommerce_subtotal = $woocommerce_subtotal + $woocommerce_product_fee;
// set fee on 0 after this line
$woocommerce_product_fee = 0;
Related
Currently, using the WooCommerce Smart Coupons plugin, when combining two different coupons, a store credit is used first and then a percentage is used on the total after the first coupon is used.
This is illogical when you give someone store credit and they want to take that amount off of the cart total AFTER using the full % off. I'd like for this to work the opposite - use the percentage off coupon, then the store credit.
To be clear: The way it works now is...
Cart subtotal = $100
$10 Store credit coupon = -$10
10% off coupon = -$9
Cart total = $81
The way it SHOULD work is...
Cart subtotal = $100
$10 Store credit coupon = -$10
10% off coupon = -$10
Cart total = $80
Does anyone else have this issue? If so, how can it be fixed? Thanks!
EDIT 1: I've narrowed down this issue to being with the Smart Coupons plugin after disabling it and the calculations working as they should once disabled.
The solution for me was to UNCHECK a line item in the Woocommerce settings under the "General" tab and "Enable Coupons" section that says "Calculate coupon discounts sequentially"
I'm having issue with calculation of price without tax, when I put price without discount it counts okay, because I made some changes in presta core, for example if I put product with price of 4,5 tax incl and 8% tax I get price - 4,17 tax excl, and that is correct.
(4,5*100)/108 = 4,16666 rounds up.
After giving specific price -15% I get price tax incl 3,83 which is correct, but I get 3,54 price tax excl which is incorrect (correct should be 3,55), I assume that everything counts using price tax excl instead of incl and counts like this
4,17 - (4,17*0,15) = 3,5445 (which php rounds to 3,54 instead of 3,55),
Do you have any idea in which controller or source file should I look to modify PrestaShop behaviour?
Inside "Product" class, check the static method getPriceStatic that is basically handling everything related to retrieving a product price.
You'll end to explore Product::priceCalculation and many methods on the SpecificPrice class that are related to calculation of discounts.
I'm trying to take account of the package weight in the total weight of the cart so I can bill the right shipping cost.
I tried adding a filter on 'woocommerce_cart_contents_weight' like explained there
So I added the following code snippet
function add_package_weight_to_cart_contents_weight( $weight ) {
$weight = $weight * 1.3; // add 30%
return $weight;
}
add_filter('woocommerce_cart_contents_weight', 'add_package_weight_to_cart_contents_weight');
I've also added a snippet to print cart weight on cart page, and I can see that the weight filter isn't applied : The total weight of the cart doesn't change wether the snippet is active or not.
I also tried putting exactly 900g articles in the cart so that, with the box weight, it goes over 1kg and change price, but the shipping price is still the one for under 1kg.
Any idea on why it isn't applied and how I could fix it ?
Your code works and only affects WC_Cart method get_cart_contents_weight() usage.
Now for shipping methods, as cart items can be divided into packages, the weight is calculated for each shipping package and doesn't use WC_Cart method get_cart_contents_weight(). Instead it will make a calculation on the cart items for each package.
A possible way should be to use the filter hook woocommerce_package_rates to alter cost based on the package weight calculation. But this is going to be much more complicated as it seems that you are using 3rd party plugins.
I'm using magento C.E 1.7. I use all shipping methods of magento and I'm viewing only one shipping method in the front end, which has higher priority. I'm using table rate shipping for some countries.
I wanted to add special fixed shipping price for some products when they shipped to that countries only. So that, I added new shipping method namely 'flat rate per product', by using a new module.
Based on this module, a text box is added to all the products in admin to specify the special shipping price. If I filled this field with some value, It considers it as a special shipping price. And if not filled it, it will be considered as special shipping price is $0.
So I have given least priority in the sort order for this shipping method to avoid this method from viewing on front end when products without special shipping price and products with special shipping price both are added into the cart.
So that, If only the special shipping priced product is added to the cart, It shows only table rate shipping method in front end.
I checked the code in availble.phtml. There is a foreach loop to proceed with available shipping methods. I need to check the availability of the 'flat rate per product' and it's price value for the product before start of loop execution.
I tried to get all the values of the array. But I could not. Can anyone help on this?
you can use this code:
<?php
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
$shipMethods = array();
foreach ($methods as $shippigCode=>$shippingModel)
{
$shippingTitle = Mage::getStoreConfig('carriers/'.$shippigCode.'/title');
$shipMethods[$shippigCode] = $shippingTitle;
}
return $shipMethods;
?>
For a customer I am building a Virtuemart 2.0.26d website.
Because of a local law, for each unit of a product that is ordered a fee must be added.
So, when ordering 4 products, the fee must be charged 4 times. By law it is required that the total sum of this fee is visible on the invoice/order confirmation.
I looked at the price rules in Virtuemart, but they don't seem to have an option for this. There is a price modifier after tax, but then the fee is visibile as an negative discount. Something I don't want.
The only solution I came up with is to make a new product for the fee and programmatically add this product for each unit. Can this be done by making a Virtuemart Plugin, or must I change the core for this?
Or are there better solutions for this problem?
You can add extra charge by Taxes & Calculation Rules.
create new rules and select tax per product for Type of Arithmetic Operation and select Math Operation + Or +% as per you want to add extra fee per product.
You could add a custom field to each product with the fee amount and alter the code of the payment plugin to add this fee to your order.