Support » Plugins » Plugin: WooCommerce] Pass variables to checkout shipping fields

  • I’m trying to use PHP to pass variables from a text input field on my single product page to the checkout screen. It’s meant to add the name and address to the checkout screen for shipping so it’s already populated. I used the example here and in my templates/single-product/add-to-cart/simple.php template I added this to my template:

    <input type="text" size="25" name="shipping_first_name" value="SHIP TO:" />

    Great. This worked fine and appeared on my product page.

    Now I went to templates/shipping/form-shipping.php page I added this code right after <div class=”shipping_address”>.

    <?php $shipping_first_name = $_POST['shipping_first_name']; ?>

    That didn’t work. However, I’m not sure that’s the right place for it at all. Has anyone done anything similar?

  • The topic ‘Plugin: WooCommerce] Pass variables to checkout shipping fields’ is closed to new replies.