如何在Prestashop购物车中获取和使用自定义值

I am new to Prestashop and not quite familiar with the structure of it, but i did manage to setup a custom product field called quantity_step using a tutorial, which is going to be used by the quantity input to determine the step size.

In the product page template product-add-to-cart.tpl there is absolutely no problem getting the value of my custom field {$product.quantity_step}

<input
  type="text"
  name="qty"
  id="quantity_wanted"
  value="{$product.quantity_wanted}"
  class="input-group"
  step="{$product.quantity_step}" 
  min="{$product.minimal_quantity}"
  aria-label="{l s='Quantity' d='Shop.Theme.Actions'}"
/>

On the other hand, i can't seem to get it to work in the cart template cart-detailed-product-line.tpl:

<input
  class="js-cart-line-product-quantity"
  data-down-url="{$product.down_quantity_url}"
  data-up-url="{$product.up_quantity_url}"
  data-update-url="{$product.update_quantity_url}"
  data-product-id="{$product.id_product}"
  type="text"
  value="{$product.quantity}"
  name="product-quantity-spin"
  step="{$product.quantity_step}"
  min="{$product.minimal_quantity}"
/>

My custom field returns null, while the built in field {$product.minimal_quantity} is working of course.

I have a strong feeling i need to change some file somewhere to add my custom value to the {$product}-object, i just can't find that file, as i don't know what to look for :(

If it helps, i am using the classic theme.

Thank you!

Look up in the src/Adapter/Cart/CartPresenter.php method presentProduct I think it is that what are you need. Just add new parameter to $rawProduct['quantity_step'] = 'value'

You are supposed to save the value in the DB when the product is added to the Cart and that will be done in the CartController.php class file in postProcess() function.

My Recommendation: You should create a separate DB table for saving the value of your custom field and leave the default Cart and Product object(s) alone, else you will face some serious issues with the core functionalities of PrestaShop.