add product with special price to cart drupal7 I used the following code to implement "add to cart" in my tpl.php file, and it works fine:

$product=commerce_product_load($node-&gt;field_product['und'][0]['product_id']);
$line_item = commerce_product_line_item_new($product,1);
$line_item-&gt;data['context']['product_ids'] = array($product-&gt;product_id);
$show_quantity = TRUE;

$form = drupal_get_form('commerce_cart_add_to_cart_form', $line_item,$show_quantity);
print render($form);


Right now, it can only use its original price. However, I want to add this product with a special price to the cart and use this special price to checkout. 

I have already created a "Price" field named "field_special_price", and if I use print_r($product), I can see its value and can use the value by $product-&gt;field_special_price['und'][0]['amount']
You need to use a rule that acts on the "Calculating the sales price of an item" and then set the price using that rule. Here is an example: https://drupalcommerce.org/user-guide/sell-price-calculation