3

The case is

When user place an order, shipping price must be manually calculated before the final invoice is sent to user.

What I do

I create Price custom field on Order named shippingfee.

Problem is

How to make shippingfee field affect the Order price?

Another thing that I tried is creating custom line item type. I'm thinking that by creating this custom line item type would update the value.But following this tutorial, the custom line item type did not appear when I check on admin/commerce/config/line-items.

Code added to custom module:

/**
 * Implements hook_commerce_line_item_type_info().
 */
function owemji_commerce_line_item_type_info() {
  return array(
    'owemji' => array(
        'name' => t('Shipping Fee'),
        'product' => false,
        'description' => t('Price of shipping.'),
        'base' => 'owemji',
    ),
  );
}

/**
 * Implements hook_enable().
 */
function owemji_enable() {
  commerce_line_item_configure_line_item_fields(array('owemji'));
}

I did try clear cache and disable -> enable the owemji module, but it's still not there.

  • FYI: There is a module for custom line item types creation: Commerce Customizable Products – milkovsky Apr 30 '15 at 10:14
  • approach with order price is wrong. order price should be calculated with line items. see my answer below about 'commerce_shipping' and 'Commerce Flat Rate' module. It creates shipping line item from the box and takes care about all the calculations. The only thing you need to do is configure rules. See the videos in my answer – milkovsky May 7 '15 at 10:20
3
+25

There is a contrib module developed espacially for shipping - Commerce Flat Rate

This module allows you to define any number of flat rate shipping services via the user interface in conjunction with Commerce Shipping 2.x. When you define a new flat rate service, you specify the base rate for it in the add / edit form. You can further modify the base rate (enabling things like weight or quantity based shipping) using rate calculation rules.

This is functionally equivalent to using product pricing rules to add discounts or fees to base product prices before adding them to the cart.

There are few old but still actual video casts from rfay about Commerce Shipping. Watch it for a basic understanding:

| improve this answer | |
0

I think you can commerce_fees and if you want update you price according to user data you can do it with some custom coding and this module is what you want.

| improve this answer | |
0

As @milkovsky said Commerce Flat Rate seems like the way to go.

Or if you want an even simpler solution : just create a Shipping product and manually add it to your order when you know the shipping.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.