Hello,
I want to change the default price and quantity for a specific product and set the price and quantity from my custom table and display them into the product view page. I am new here. Please help me how to do this
Thank you in advance
My question is that why would you want to do that? Why don't you put your custom price in the price section at first place?
Secondly, if you are really keen to do that the one option is to either use special price feature of Magento or create a new attribute, add in the attribute set and put your custom price in it.
I hope that helps.
Actually I want to display different price for different date, thats why I want to fetch the price from my custom table date wise and I also want that price will work from my custom table.
Hi,
You can try by creating a plugin
In di.xml, <type name="Magento\Catalog\Model\Product"><plugin name="change_product_price" type="\vendorname\Catalog\Plugin\ProductPlugin" sortOrder="1"/></type>
in plugin file, create a function
public function afterGetPrice(\Magento\Catalog\Model\Product $subject, $result)
$subject has product details. Inside this function, fetch the price from the custom table and return the price.