[Skip to main content](#vessel-content)

#   Add the same price in all products automatically

##

- **[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")**
- [![verzevoul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8351-verzevoul "View verzevoul's Profile") Topic Author
- [ Offline](/forum/user/8351-verzevoul)

Less More

- Posts: 1195
- Thank you received: 13
-
-

3 years 1 month ago -  3 years 1 month ago [\#355578](#355578) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  *[Add the same price in all products automatically](/forum/44-mass-actions/907077-add-the-same-price-in-all-products-automatically#355578 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 3.10.12  Hello!  Is there a way to add the same price in all the products with a mass action or automatically somehow else?  My question is based on  Thank you")* was created by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")*

-- HikaShop version -- : 4.7.5
-- Joomla version -- : 3.10.12

Hello!

Is there a way to add the same price in all the products with a mass action or automatically somehow else?

My question is based on [ this](https://www.hikashop.com/forum/product-category-display/907070-display-add-to-cart-only-to-logged-users.html)

Thank you

Last edit: 3 years 1 month ago by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDcwNzctYWRkLXRoZS1zYW1lLXByaWNlLWluLWFsbC1wcm9kdWN0cy1hdXRvbWF0aWNhbGx5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

3 years 1 month ago [\#355581](#355581) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add the same price in all products automatically](/forum/44-mass-actions/907077-add-the-same-price-in-all-products-automatically#355581 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 3.10.12  Hello!  Is there a way to add the same price in all the products with a mass action or automatically somehow else?  My question is based on  Thank you")*

Hi,

I don't think you can add a price to products with a mass action.
You can only update existing prices.
The only solution would be to use a "run PHP code" action with something like that: Code:

$class = hikashop_get('class.product'); $product = new stdClass(); $product-&gt;prices = array(); $price = new stdClass(); $price-&gt;price_currency_id = 1; // replace 1 by the id of your currency $price-&gt;price_value = 0.0001; $product-&gt;prices []= $price; $class-&gt;updatePrices($product, {product.product_id});

Beware that this will forcefully delete all the prices of the products / variants matching the mass action and add this 0.001 price to them. So before running that action, make sure you test the filters of your mass action with a "display the results" action as this price adding action can't be reversed automatically (unless you run another mass action with a PHP code action.

The following user(s) said Thank You: [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDcwNzctYWRkLXRoZS1zYW1lLXByaWNlLWluLWFsbC1wcm9kdWN0cy1hdXRvbWF0aWNhbGx5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")**
- [![verzevoul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8351-verzevoul "View verzevoul's Profile") Topic Author
- [ Offline](/forum/user/8351-verzevoul)

Less More

- Posts: 1195
- Thank you received: 13
-
-

3 years 1 month ago [\#355759](#355759) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  Replied by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")* on topic *[Add the same price in all products automatically](/forum/44-mass-actions/907077-add-the-same-price-in-all-products-automatically#355759 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 3.10.12  Hello!  Is there a way to add the same price in all the products with a mass action or automatically somehow else?  My question is based on  Thank you")*

Hello !
Running the code
$class = hikashop_get('class.product');
$product = new stdClass();
$product-&gt;prices = array();
$price = new stdClass();
$price-&gt;price_currency_id = 1; // replace 1 by the id of your currency
$price-&gt;price_value = 0.0001;
$product-&gt;prices []= $price;
$class-&gt;updatePrices($product, {product.product_id});

I get
Action PHP code is wrong: syntax error, unexpected token "{", expecting ")"

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDcwNzctYWRkLXRoZS1zYW1lLXByaWNlLWluLWFsbC1wcm9kdWN0cy1hdXRvbWF0aWNhbGx5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")**
- [![verzevoul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8351-verzevoul "View verzevoul's Profile") Topic Author
- [ Offline](/forum/user/8351-verzevoul)

Less More

- Posts: 1195
- Thank you received: 13
-
-

3 years 1 month ago [\#355760](#355760) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  Replied by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")* on topic *[Add the same price in all products automatically](/forum/44-mass-actions/907077-add-the-same-price-in-all-products-automatically#355760 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 3.10.12  Hello!  Is there a way to add the same price in all the products with a mass action or automatically somehow else?  My question is based on  Thank you")*

> verzevoul wrote: Hello !
> Running the code
> $class = hikashop\_get('class.product');
> $product = new stdClass();
> $product-&gt;prices = array();
> $price = new stdClass();
> $price-&gt;price\_currency\_id = 1; // replace 1 by the id of your currency
> $price-&gt;price\_value = 0.0001;
> $product-&gt;prices \[\]= $price;
> $class-&gt;updatePrices($product, {product.product\_id});
>
> I get
> Action PHP code is wrong: syntax error, unexpected token "{", expecting ")"

I then tried
$class = hikashop_get('class.product');
$product = new stdClass();
$product-&gt;prices = array();
$price = new stdClass();
$price-&gt;price_currency_id = 1;
$price-&gt;price_value = 0.0001;
$product-&gt;prices []= $price;
$class-&gt;updatePrices($product, (product.product_id));

but I get
Error
Action PHP code is wrong: Undefined constant "product"

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDcwNzctYWRkLXRoZS1zYW1lLXByaWNlLWluLWFsbC1wcm9kdWN0cy1hdXRvbWF0aWNhbGx5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

3 years 1 month ago [\#355765](#355765) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add the same price in all products automatically](/forum/44-mass-actions/907077-add-the-same-price-in-all-products-automatically#355765 "-- HikaShop version -- : 4.7.5 -- Joomla version -- : 3.10.12  Hello!  Is there a way to add the same price in all the products with a mass action or automatically somehow else?  My question is based on  Thank you")*

Hi,

Change {product.product_id} to {product_id} and it should help.

The following user(s) said Thank You: [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDcwNzctYWRkLXRoZS1zYW1lLXByaWNlLWluLWFsbC1wcm9kdWN0cy1hdXRvbWF0aWNhbGx5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.076 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
