Adding secondary product to product page

New Member
1 0 0


I'm trying to add a secondary Add To Cart button which should add a different product (samples).


I tried using the AJAX API -> Cart API to add the product


Tried to call the API from the developer console and from an script tag, but I receive a 404 error


let formData = {
 'items': [{
  'id': $ProductID,
  'quantity': 1

fetch('/cart/add.js', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  body: JSON.stringify(formData)
.then(response => {
  return response.json();
.catch((error) => {
  console.error('Error:', error);



After that I tried to add a second {% form 'product' %} tag after/outside the standard Add to cart form. But when I add the form below, the submit from the original add to cart also adds the sample product instead of the original one



Maybe someone can help with either of approaches