cancel
Showing results for 
Search instead for 
Did you mean: 

Change default price for a specific product

Change default price for a specific product

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

3 REPLIES 3

Re: Change default price for a specific product

@ashim_admantiz

 

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. 

 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

Re: Change default price for a specific product

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.

Re: Change default price for a specific product

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.