• Hi there,

    I want to modify the code for each product, generated in the WooCommerce products loop /products archive page/.

    By default it is something like this:

    
    <li class="post-401 product type-product status-publish
     has-post-thumbnail first-post first instock shipping-taxable
     purchasable product-type-variable has-default-attributes
     has-children">
    	<a href="/product/some-product-name/" class="woocommerce-LoopProduct-link">
              <img src="/wp-content/uploads/YYYY/MM/product-image.jpg" 
    class="attachment-shop_catalog size-shop_catalog wp-post-image" 
    alt="Some Product Name" title="" srcset="..." sizes="...">
                <h3>Some Product Name Title</h3>
    
    	<span class="price">
              <span class="woocommerce-Price-amount amount">
                <span class="woocommerce-Price-currencySymbol">$</span>100.00</span></span>
    </a>
    
    <a rel="nofollow" href="/product/some-product-name/" data-quantity="1" 
    data-product_id="401" data-product_sku="SSXXXXXX" 
    class="button product_type_variable add_to_cart_button">
    Select options
    </a>
    </li>
    

    I want to be able to change the code, that generates all of the above.
    One way, that I can think of, is to combine the several hooks, that make /construct/ the code above and replace them with a custom function.
    For example, this function should remove all default hooks, that generate the code and replace it by adding a custom construct /custom code to replace the default/.

    Can someone help with an usable code example for that?
    Let’s say I want the SELECT OPTIONS button before the product title and inside a div, that will hold the product thumb and this button?

    The CONTENT-PRODUCT.PHP seems to hold those hooks, I know how to remove them, but I’m not sure how to implement the replacing code /should I replace function by function and then reorder them with a custom content-product.php file overwrite or can I have a combined function that removes all of the hooks and replaces them at the same time – the latter sounds better to me, but not sure if possible?/

    I would really appreciate usable code example!
    Thank you, guys 🙂

    • This topic was modified 7 years, 5 months ago by ramones79.
    • This topic was modified 7 years, 5 months ago by ramones79.
    • This topic was modified 7 years, 5 months ago by ramones79.
    • This topic was modified 7 years, 5 months ago by ramones79.
  • The topic ‘[WooCommerce] Alter separate products in the loop’ is closed to new replies.