Title: ERROR Multiplying Shipping Classes
Last modified: April 8, 2021

---

# ERROR Multiplying Shipping Classes

 *  [jordanmero](https://wordpress.org/support/users/jordanmero/)
 * (@jordanmero)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/error-multiplying-shipping-classes/)
 *     ```
       I have created the shipping classes successfully, but I can't use the * [qty] function.
   
       however, there is a progressive option
       "Per Piece - Accumulate total by multiplying the quantity"
   
       but this option gives a multiplication error in sending
       since it does not multiply the number of times of the product by the shipping value of the class. What it does is a miscalculation that doesn't make sense.
   
       Any solution?
   
       I have seen the code inside
       foreach ($ progressive as $ value) {
       $ costs [$ value ['product_id']] = $ value ['item_cost'] * $ item ['quantity'];
       }
       In theory it makes sense but it doesn't work and it keeps doing a wrong calculation
   
       For instance:
       Product 1 ($ 3.19) - x- (4) qty (Shipping cost $ 5.00 x piece)
       Standard Cost $ 3
       Total shipping should be = $ 3 + $ 20 = $ 23.00
       but for some reason that I do not know the shipping value appears $ 74.85
   
       I have tried it with products of different prices thinking that I was multiplying the value of the product by the shipping cost, but the result is exactly the same
   
       any ideas?
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [jordanmero](https://wordpress.org/support/users/jordanmero/)
 * (@jordanmero)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/error-multiplying-shipping-classes/#post-14295868)
 * I just recently solve change the code with one parameter
 * search in include\clasess\class-wcsdm-shipping-method.php
 *     ```
       foreach ($ progressive as $ value) {
       $ costs [$ value ['product_id']] = $ value ['item_cost'] * $ item ['quantity'];
       }
       ```
   
 * change for
 *     ```
       foreach ($ progressive as $ value) {
       $costs[ $value['product_id'] ] = $class_cost * $value['quantity'];
       }
       ```
   
 * works for me, so i hope you can resolve and update the plugin
 * Best Regards
 *  Plugin Author [Sofyan Sitorus](https://wordpress.org/support/users/sofyansitorus/)
 * (@sofyansitorus)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/error-multiplying-shipping-classes/#post-14302906)
 * Hello [@jordanmero](https://wordpress.org/support/users/jordanmero/) ,
 * Thanks for the report and the fix submission. But `$class_cost` variable in there
   is not suppose to be used anymore in that code block. Maybe it will fix your 
   case, but can cause issue in another case.
 * Could you please include the screenshot of your table rate settings and the advanced
   rate settings? It will really helpful for me to reproduce your issue.
 * Sofyan

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘ERROR Multiplying Shipping Classes’ is closed to new replies.

 * ![](https://ps.w.org/wcsdm/assets/icon-256x256.png?rev=3405790)
 * [WooReer](https://wordpress.org/plugins/wcsdm/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wcsdm/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wcsdm/)
 * [Active Topics](https://wordpress.org/support/plugin/wcsdm/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wcsdm/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wcsdm/reviews/)

## Tags

 * [shipping classes](https://wordpress.org/support/topic-tag/shipping-classes/)

 * 2 replies
 * 2 participants
 * Last reply from: [Sofyan Sitorus](https://wordpress.org/support/users/sofyansitorus/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/error-multiplying-shipping-classes/#post-14302906)
 * Status: not resolved