Support

Account

Home Forums General Issues Add Custom Fields to Woocommerce Cart Reply To: Add Custom Fields to Woocommerce Cart

  • This is a code snippet from the cart.php file. Specifically for the table item named Product. How would I replace the woocommerce product title with an ACF field??? My logic is… if I can get a single field to show anywhere on the cart page, I should be able to figure out the rest on my own.

    <?php
    							if ( ! $_product->is_visible() ) {
    								echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . '&nbsp;';
    							} else {
    								echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a class="cart-link" href="%s">%s </a>', esc_url( $_product->get_permalink( $cart_item ) ), $_product->get_title() ), $cart_item, $cart_item_key );
    							}
    
    							// Meta data
    							echo WC()->cart->get_item_data( $cart_item );
    
    							// Backorder notification
    							if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
    								echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>';
    							}
    						?>