Skip to main content
added 189 characters in body
Source Link
Luke Pearce
  • 3.9k
  • 1
  • 12
  • 25

This is definitely possible. First create a file field to attach to your order in the control panel. Then create a file input type with a name attribute that uses the field you created name="fields[fieldName]". This would then get sent in the post request to updateCart.

<form method="POST" enctype="multipart/form-data">
  <input type="hidden" name="action" value="commerce/cart/updateCart">
  {{ getCsrfInput() }}
  <input type="file" name="fields[fieldName][]">
  <button type="submit">Upload file</button>
</form>

Then you could show the image on the cart/order using something like the following:

{% if cart.fieldName|length %}
  <img src="{{ cart.fieldName[0].url }}">
{% endif %}

This is definitely possible. First create a file field to attach to your order in the control panel. Then create a file input type with a name attribute that uses the field you created name="fields[fieldName]". This would then get sent in the post request to updateCart.

<form method="POST" enctype="multipart/form-data">
  <input type="hidden" name="action" value="commerce/cart/updateCart">
  {{ getCsrfInput() }}
  <input type="file" name="fields[fieldName][]">
  <button type="submit">Upload file</button>
</form>

This is definitely possible. First create a file field to attach to your order in the control panel. Then create a file input type with a name attribute that uses the field you created name="fields[fieldName]". This would then get sent in the post request to updateCart.

<form method="POST" enctype="multipart/form-data">
  <input type="hidden" name="action" value="commerce/cart/updateCart">
  {{ getCsrfInput() }}
  <input type="file" name="fields[fieldName][]">
  <button type="submit">Upload file</button>
</form>

Then you could show the image on the cart/order using something like the following:

{% if cart.fieldName|length %}
  <img src="{{ cart.fieldName[0].url }}">
{% endif %}
Source Link
Luke Pearce
  • 3.9k
  • 1
  • 12
  • 25

This is definitely possible. First create a file field to attach to your order in the control panel. Then create a file input type with a name attribute that uses the field you created name="fields[fieldName]". This would then get sent in the post request to updateCart.

<form method="POST" enctype="multipart/form-data">
  <input type="hidden" name="action" value="commerce/cart/updateCart">
  {{ getCsrfInput() }}
  <input type="file" name="fields[fieldName][]">
  <button type="submit">Upload file</button>
</form>