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

#   How to force default xx\_hikashop\_cart table cart\_payment\_id to 0

##

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

Less More

- Posts: 22
- Thank you received: 0
-
-

9 years 2 months ago [\#277821](#277821) by [kenny.kang](/forum/user/39538-kenny-kang "View kenny.kang's Profile")  *[How to force default xx\_hikashop\_cart table cart\_payment\_id to 0](/forum/27-checkout/891840-how-to-force-default-xx-hikashop-cart-table-cart-payment-id-to-0#277821 "-- url of the page with the problem -- :   www.bikehome.com.tw  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 5.5.9  cart&#95;payment&#95;id default is 0  While product add to cart and choosing payment method , cart&#95;payment&#95;id will set to its id (not 0) If quit the checkout progress , cart&#95;payment&#95;id not reset to 0. How can I add php code force cart&#95;payment&#95;id:0 while open checkout progress ??")* was created by *[kenny.kang](/forum/user/39538-kenny-kang "View kenny.kang's Profile")*

-- url of the page with the problem -- : [ www.bikehome.com.tw](http://www.bikehome.com.tw)
-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.5.9

cart_payment_id default is 0

While product add to cart and choosing payment method , cart_payment_id will set to its id (not 0)
If quit the checkout progress , cart_payment_id not reset to 0.
How can I add php code force cart_payment_id:0 while open checkout progress ??

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MTg0MC1ob3ctdG8tZm9yY2UtZGVmYXVsdC14eC1oaWthc2hvcC1jYXJ0LXRhYmxlLWNhcnQtcGF5bWVudC1pZC10by0wP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14297
-
-

9 years 2 months ago [\#277833](#277833) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to force default xx\_hikashop\_cart table cart\_payment\_id to 0](/forum/27-checkout/891840-how-to-force-default-xx-hikashop-cart-table-cart-payment-id-to-0#277833 "-- url of the page with the problem -- :   www.bikehome.com.tw  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 5.5.9  cart&#95;payment&#95;id default is 0  While product add to cart and choosing payment method , cart&#95;payment&#95;id will set to its id (not 0) If quit the checkout progress , cart&#95;payment&#95;id not reset to 0. How can I add php code force cart&#95;payment&#95;id:0 while open checkout progress ??")*

Hi,

The payment method is automatically preselected when the cart is loaded, whether it's on the checkout or another page which displays the cart.
Even if you set it to 0, the loading function of the cart will re-set it to the default payment method id.
So you would have to modify the "getFullCart" function of the file administrator/components/com_hikashop/classes/cart.php to load set the payment_id when not already set.
However, this might lead to some erratic behavior as the new cart and checkout system introduced in HikaShop 3 has been made with the intent of auto selecting the payment method like that in order to avoid many issues that plagued previous versions of the checkout because of that.
I would personnally advise not changing that and try to see if you can't do something else for your problematic.

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

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

Less More

- Posts: 22
- Thank you received: 0
-
-

9 years 2 months ago [\#277906](#277906) by [kenny.kang](/forum/user/39538-kenny-kang "View kenny.kang's Profile")  Replied by *[kenny.kang](/forum/user/39538-kenny-kang "View kenny.kang's Profile")* on topic *[How to force default xx\_hikashop\_cart table cart\_payment\_id to 0](/forum/27-checkout/891840-how-to-force-default-xx-hikashop-cart-table-cart-payment-id-to-0#277906 "-- url of the page with the problem -- :   www.bikehome.com.tw  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 5.5.9  cart&#95;payment&#95;id default is 0  While product add to cart and choosing payment method , cart&#95;payment&#95;id will set to its id (not 0) If quit the checkout progress , cart&#95;payment&#95;id not reset to 0. How can I add php code force cart&#95;payment&#95;id:0 while open checkout progress ??")*

My condition is

Customer has add product into cart and click checkout into the checkout process
If the customer choose one payment method and quit the checkout .
The cart_payment_id will set to the payment method.
If the customer add another product to the shopping cart and go to the checkout process again
The last choice cart_payment_id will load .

I don't want to load the last choice cart_payment_id. I wish the cart_payment_id will be 0

Where can I add the cart_payment_id=0 ??
Could I using mysql trigger instead of modify the hikashop core ??

Many Thanks!!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MTg0MC1ob3ctdG8tZm9yY2UtZGVmYXVsdC14eC1oaWthc2hvcC1jYXJ0LXRhYmxlLWNhcnQtcGF5bWVudC1pZC10by0wP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86363
- Thank you received: 14297
-
-

9 years 2 months ago [\#277933](#277933) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to force default xx\_hikashop\_cart table cart\_payment\_id to 0](/forum/27-checkout/891840-how-to-force-default-xx-hikashop-cart-table-cart-payment-id-to-0#277933 "-- url of the page with the problem -- :   www.bikehome.com.tw  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 5.5.9  cart&#95;payment&#95;id default is 0  While product add to cart and choosing payment method , cart&#95;payment&#95;id will set to its id (not 0) If quit the checkout progress , cart&#95;payment&#95;id not reset to 0. How can I add php code force cart&#95;payment&#95;id:0 while open checkout progress ??")*

Hi,

I don't see how the default behavior of the system is different from your needs ?
By default, when you add a product to the cart and go to the checkout a default payment method will be preselected in the cart_payment_id, however, the customer will still be able to change it if he wants on the checkout and that change will be saved in his cart.
If he comes back later on and add another product to the cart and go to the checkout, the previously selected payment method will still be selected and the customer will still be able to choose another one if he wants to.
So why would you want to set the cart_payment_id to 0 ? and at which point in the process ?
You could use one of the triggers called during the loading of the cart I guess... However, I've never done that so I can't guarantee anything.
[ www.hikashop.com/support/documentation/6...fterCartProductsLoad](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#onAfterCartProductsLoad)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MTg0MC1ob3ctdG8tZm9yY2UtZGVmYXVsdC14eC1oaWthc2hvcC1jYXJ0LXRhYmxlLWNhcnQtcGF5bWVudC1pZC10by0wP3RtcGw9bWFya2Rvd24=) 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.046 seconds

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