Home / Archive / MemberPress: Changes Product Image on the Checkout Page
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Changes Product Image on the Checkout Page

This code snippet changes the product image on the checkout page in MemberPress. By default, MemberPress uses the product image set in the product settings. This snippet allows you to replace that image with a new one of your choice.

Replace NEW-IMAGE-URL-HERE with the URL of the new image you want to display.

Code Preview
php
<?php
function mepr_custom_checkout_image() { ?>
<script>
(function($) {
  $(document).ready(function() {
    // Select the product image on the checkout page and change its source to a new image URL
    $(".mp-table > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > img:nth-child(1)").attr("src","NEW-IMAGE-URL-HERE");
  });
})(jQuery);
</script>
<?php }
add_action( 'wp_head', 'mepr_custom_checkout_image' );

Comments

Add a Comment