Magento 2 checkout_cart_product_add_after Observer setWeight not working Planned maintenance scheduled April 23, 2019 at 23:30UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Set custom price of product when adding to cart code not workingMagento2 adminhtml_catalog_product_grid_prepare_massaction event is not observedMagento 2 catalog_product_get_final_price event not working for configurable productMagento 2 - Category Save Event is not called when save category via rest apiMagento 2 Enterprise edition, get all custom attributes of product in the observerSet Name of quote_itemMagento-2 : How to set product custom price after add to cartMagento 2 catalog_product_get_final_price event not workingAdd event after user add the product to cart to update quantityMagento 2 controller_action_predispatch observer not working as expected
Intuitive explanation of the rank-nullity theorem
Crossing US/Canada Border for less than 24 hours
Project Euler #1 in C++
How long can equipment go unused before powering up runs the risk of damage?
Why weren't discrete x86 CPUs ever used in game hardware?
preposition before coffee
A letter with no particular backstory
What does 丫 mean? 丫是什么意思?
Google .dev domain strangely redirects to https
Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?
Co-worker has annoying ringtone
What is the meaning of 'breadth' in breadth first search?
Can a Beast Master ranger change beast companions?
Did any compiler fully use 80-bit floating point?
Why are vacuum tubes still used in amateur radios?
Drawing spherical mirrors
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
Why can't I install Tomboy in Ubuntu Mate 19.04?
How to run automated tests after each commit?
What order were files/directories output in dir?
Is there hard evidence that the grant peer review system performs significantly better than random?
How can I prevent/balance waiting and turtling as a response to cooldown mechanics
What does this say in Elvish?
Why does 14 CFR have skipped subparts in my ASA 2019 FAR/AIM book?
Magento 2 checkout_cart_product_add_after Observer setWeight not working
Planned maintenance scheduled April 23, 2019 at 23:30UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Set custom price of product when adding to cart code not workingMagento2 adminhtml_catalog_product_grid_prepare_massaction event is not observedMagento 2 catalog_product_get_final_price event not working for configurable productMagento 2 - Category Save Event is not called when save category via rest apiMagento 2 Enterprise edition, get all custom attributes of product in the observerSet Name of quote_itemMagento-2 : How to set product custom price after add to cartMagento 2 catalog_product_get_final_price event not workingAdd event after user add the product to cart to update quantityMagento 2 controller_action_predispatch observer not working as expected
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am working with magento 2.0.10 , I have created an observer to set product price and weight posted from products details page using custom attribute. In the below example i am trying to set static price and weight. But for price attribute its working correct , but not able to set weight , the quote item is giving actual product weight while calculating shipping. Even if i change the observer event to sales_quote_item_set_product not working at all for changing weight.
And even now i have tested with magento 2.1 as well. Not working at all
In events.xml and I am creating observer like below
<event name="checkout_cart_product_add_after">
<observer name="checkout_cart_product_add_after_customprice" instance="TestSliderObserverCustomprice" />
</event>
And script that i have used in my observer is working like this
$item = $observer->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$item->setCustomPrice(10);
$item->setOriginalCustomPrice(10);
$item->setWeight(10);
$item->getProduct()->setIsSuperMode(true);
magento2 magento-2.1 magento-2.0
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am working with magento 2.0.10 , I have created an observer to set product price and weight posted from products details page using custom attribute. In the below example i am trying to set static price and weight. But for price attribute its working correct , but not able to set weight , the quote item is giving actual product weight while calculating shipping. Even if i change the observer event to sales_quote_item_set_product not working at all for changing weight.
And even now i have tested with magento 2.1 as well. Not working at all
In events.xml and I am creating observer like below
<event name="checkout_cart_product_add_after">
<observer name="checkout_cart_product_add_after_customprice" instance="TestSliderObserverCustomprice" />
</event>
And script that i have used in my observer is working like this
$item = $observer->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$item->setCustomPrice(10);
$item->setOriginalCustomPrice(10);
$item->setWeight(10);
$item->getProduct()->setIsSuperMode(true);
magento2 magento-2.1 magento-2.0
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
It would be saving under field row_weight, not sure why but if you can adjust to use it at required places by using $item->getRowWeight() in your calculations..
– Himmat Paliwal
Nov 2 '18 at 6:35
add a comment |
I am working with magento 2.0.10 , I have created an observer to set product price and weight posted from products details page using custom attribute. In the below example i am trying to set static price and weight. But for price attribute its working correct , but not able to set weight , the quote item is giving actual product weight while calculating shipping. Even if i change the observer event to sales_quote_item_set_product not working at all for changing weight.
And even now i have tested with magento 2.1 as well. Not working at all
In events.xml and I am creating observer like below
<event name="checkout_cart_product_add_after">
<observer name="checkout_cart_product_add_after_customprice" instance="TestSliderObserverCustomprice" />
</event>
And script that i have used in my observer is working like this
$item = $observer->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$item->setCustomPrice(10);
$item->setOriginalCustomPrice(10);
$item->setWeight(10);
$item->getProduct()->setIsSuperMode(true);
magento2 magento-2.1 magento-2.0
I am working with magento 2.0.10 , I have created an observer to set product price and weight posted from products details page using custom attribute. In the below example i am trying to set static price and weight. But for price attribute its working correct , but not able to set weight , the quote item is giving actual product weight while calculating shipping. Even if i change the observer event to sales_quote_item_set_product not working at all for changing weight.
And even now i have tested with magento 2.1 as well. Not working at all
In events.xml and I am creating observer like below
<event name="checkout_cart_product_add_after">
<observer name="checkout_cart_product_add_after_customprice" instance="TestSliderObserverCustomprice" />
</event>
And script that i have used in my observer is working like this
$item = $observer->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$item->setCustomPrice(10);
$item->setOriginalCustomPrice(10);
$item->setWeight(10);
$item->getProduct()->setIsSuperMode(true);
magento2 magento-2.1 magento-2.0
magento2 magento-2.1 magento-2.0
edited Nov 18 '16 at 12:33
Dinesh Saini
asked Nov 14 '16 at 13:45
Dinesh SainiDinesh Saini
400217
400217
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
It would be saving under field row_weight, not sure why but if you can adjust to use it at required places by using $item->getRowWeight() in your calculations..
– Himmat Paliwal
Nov 2 '18 at 6:35
add a comment |
It would be saving under field row_weight, not sure why but if you can adjust to use it at required places by using $item->getRowWeight() in your calculations..
– Himmat Paliwal
Nov 2 '18 at 6:35
It would be saving under field row_weight, not sure why but if you can adjust to use it at required places by using $item->getRowWeight() in your calculations..
– Himmat Paliwal
Nov 2 '18 at 6:35
It would be saving under field row_weight, not sure why but if you can adjust to use it at required places by using $item->getRowWeight() in your calculations..
– Himmat Paliwal
Nov 2 '18 at 6:35
add a comment |
1 Answer
1
active
oldest
votes
Finally , i have found the solution. May be it's not the best solution , but it works
I have just commented line number 422 with script
->setWeight($this->getProduct()->getWeight())
coming inside setProduct function in the below file
/vendor/magento/module-quote/Model/Quote/Item.php
And its working for me.
You know that changing code in a file that's invendorwill be overwritten as soon as a newer version of that file/module is available and installed. I have to be honest, I don't know the answer right away, but I don't think this will be the solution you're looking for.
– Arjen Miedema
Feb 27 '18 at 6:24
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f145662%2fmagento-2-checkout-cart-product-add-after-observer-setweight-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Finally , i have found the solution. May be it's not the best solution , but it works
I have just commented line number 422 with script
->setWeight($this->getProduct()->getWeight())
coming inside setProduct function in the below file
/vendor/magento/module-quote/Model/Quote/Item.php
And its working for me.
You know that changing code in a file that's invendorwill be overwritten as soon as a newer version of that file/module is available and installed. I have to be honest, I don't know the answer right away, but I don't think this will be the solution you're looking for.
– Arjen Miedema
Feb 27 '18 at 6:24
add a comment |
Finally , i have found the solution. May be it's not the best solution , but it works
I have just commented line number 422 with script
->setWeight($this->getProduct()->getWeight())
coming inside setProduct function in the below file
/vendor/magento/module-quote/Model/Quote/Item.php
And its working for me.
You know that changing code in a file that's invendorwill be overwritten as soon as a newer version of that file/module is available and installed. I have to be honest, I don't know the answer right away, but I don't think this will be the solution you're looking for.
– Arjen Miedema
Feb 27 '18 at 6:24
add a comment |
Finally , i have found the solution. May be it's not the best solution , but it works
I have just commented line number 422 with script
->setWeight($this->getProduct()->getWeight())
coming inside setProduct function in the below file
/vendor/magento/module-quote/Model/Quote/Item.php
And its working for me.
Finally , i have found the solution. May be it's not the best solution , but it works
I have just commented line number 422 with script
->setWeight($this->getProduct()->getWeight())
coming inside setProduct function in the below file
/vendor/magento/module-quote/Model/Quote/Item.php
And its working for me.
answered Nov 28 '16 at 7:42
Dinesh SainiDinesh Saini
400217
400217
You know that changing code in a file that's invendorwill be overwritten as soon as a newer version of that file/module is available and installed. I have to be honest, I don't know the answer right away, but I don't think this will be the solution you're looking for.
– Arjen Miedema
Feb 27 '18 at 6:24
add a comment |
You know that changing code in a file that's invendorwill be overwritten as soon as a newer version of that file/module is available and installed. I have to be honest, I don't know the answer right away, but I don't think this will be the solution you're looking for.
– Arjen Miedema
Feb 27 '18 at 6:24
You know that changing code in a file that's in
vendor will be overwritten as soon as a newer version of that file/module is available and installed. I have to be honest, I don't know the answer right away, but I don't think this will be the solution you're looking for.– Arjen Miedema
Feb 27 '18 at 6:24
You know that changing code in a file that's in
vendor will be overwritten as soon as a newer version of that file/module is available and installed. I have to be honest, I don't know the answer right away, but I don't think this will be the solution you're looking for.– Arjen Miedema
Feb 27 '18 at 6:24
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f145662%2fmagento-2-checkout-cart-product-add-after-observer-setweight-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It would be saving under field row_weight, not sure why but if you can adjust to use it at required places by using $item->getRowWeight() in your calculations..
– Himmat Paliwal
Nov 2 '18 at 6:35