Woo Commerce Store

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Frye9876
New php-forum User
New php-forum User
Posts: 2
Joined: Mon Apr 07, 2014 11:21 am

Woo Commerce Store

Postby Frye9876 » Mon Apr 07, 2014 12:21 pm

I am trying to customize the Woo Commerce WordPress plugin to better fit the needs of a flower shop. I have sorted almost everything but it's not completely customer ready.

You can view the site at http://painless.technology/bayhillflorist.com

My biggest challenge has been preventing the site from collecting a delivery address when the customer selects local pickup. For local pickup we only collect Recipient First and Last name as well as the enclosure card notes. I was able to retrofit "Billing same as shipping" in to an "Uncheck for local delivery" option on the checkout page: http://painless.technology/bayhillflorist.com/checkout/ This almost does the trick but it removes Recipient first and last name when local delivery is selected.

I would like to eliminate First and Last name from Recipient Information altogether and create new fields for them with enclosure card that will be there if the "Local delivery" box is checked or unchecked. Can someone help point me in the right direction? I'm pretty lost right now. Thanks! Here are some of the .php files:

/templates/checkout/form-checkout.php

Code: Select all

<?php
/**
 * Checkout Form
 *
 * @author       WooThemes
 * @package    WooCommerce/Templates
 * @version     2.0.0
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

global $woocommerce;

wc_print_notices();

do_action( 'woocommerce_before_checkout_form', $checkout );

// If checkout registration is disabled and not logged in, the user cannot checkout
if ( ! $checkout->enable_signup && ! $checkout->enable_guest_checkout && ! is_user_logged_in() ) {
   echo apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'woocommerce' ) );
   return;
}

// filter hook for include new pages inside the payment method
$get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', WC()->cart->get_checkout_url() ); ?>

<form name="checkout" method="post" class="checkout" action="<?php echo esc_url( $get_checkout_url ); ?>">

   <?php if ( sizeof( $checkout->checkout_fields ) > 0 ) : ?>

      <?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>

      <div class="col2-set" id="customer_details">

         <div class="col-1">

            <?php do_action( 'woocommerce_checkout_billing' ); ?>

         </div>

         <div class="col-2">

            <?php do_action( 'woocommerce_checkout_shipping' ); ?>

         </div>

      </div>

      <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>

      <h3 id="order_review_heading"><?php _e( 'Your order', 'woocommerce' ); ?></h3>

   <?php endif; ?>

   <?php do_action( 'woocommerce_checkout_order_review' ); ?>

</form>

<?php do_action( 'woocommerce_after_checkout_form', $checkout ); ?>


templates/checkout/form-shipping.php

Code: Select all

<?php
/**
 * Checkout shipping information form
 *
 * @author       WooThemes
 * @package    WooCommerce/Templates
 * @version     2.1.2
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<div class="woocommerce-shipping-fields">
   <?php if ( WC()->cart->needs_shipping() && ! WC()->cart->ship_to_billing_address_only() ) : ?>

      <?php
         if ( empty( $_POST ) ) {

            $ship_to_different_address = get_option( 'woocommerce_ship_to_billing' ) == 'no' ? 1 : 0;
            $ship_to_different_address = apply_filters( 'woocommerce_ship_to_different_address_checked', $ship_to_different_address );

         } else {

            $ship_to_different_address = $checkout->get_value( 'ship_to_different_address' );

         }
      ?>
      <h3>Recipient Info (Them)</h3>
   
 
         <?php do_action( 'woocommerce_before_order_notes', $checkout ); ?>

   <?php if ( apply_filters( 'woocommerce_enable_order_notes_field', get_option( 'woocommerce_enable_order_comments', 'yes' ) === 'yes' ) ) : ?>

      <?php if ( ! WC()->cart->needs_shipping() || WC()->cart->ship_to_billing_address_only() ) : ?>

         <h3><?php _e( 'Additional Information', 'woocommerce' ); ?></h3>

      <?php endif; ?>

      <?php foreach ( $checkout->checkout_fields['order'] as $key => $field ) : ?>

         <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>

      <?php endforeach; ?>

   <?php endif; ?>

   <?php do_action( 'woocommerce_after_order_notes', $checkout ); ?>

   
      <h6 id="ship-to-different-address">
         <label for="ship-to-different-address-checkbox" class="checkbox"><?php _e( 'Uncheck for local pickup', 'woocommerce' ); ?></label>
         <input id="ship-to-different-address-checkbox" class="input-checkbox" <?php checked( $ship_to_different_address, 1 ); ?> type="checkbox" name="ship_to_different_address" value="1" />
      </h6>
      
      <div class="shipping_address">

         <?php do_action( 'woocommerce_before_checkout_shipping_form', $checkout ); ?>

         <?php foreach ( $checkout->checkout_fields['shipping'] as $key => $field ) : ?>

            <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>

         <?php endforeach; ?>

         <?php do_action( 'woocommerce_after_checkout_shipping_form', $checkout ); ?>

      </div>

   <?php endif; ?>


</div>

Frye9876
New php-forum User
New php-forum User
Posts: 2
Joined: Mon Apr 07, 2014 11:21 am

Re: Woo Commerce Store

Postby Frye9876 » Mon Apr 07, 2014 4:00 pm



Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron