Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last month.
Improve this question
I've been struggling to change the layout of my woocommerce checkout page. I'd like to move the Shipping details to the right, so it's side-by-side with the billing. I was able to move the order details section to the right side via CSS but I also want the shipping to move there, just above the order summary and I can't seem to do it in CSS.
You have to override the WooCommerce checkout form.
How to override:
Copy the checkout form from the path plugins/woocommerce/templates/checkout/form-checkout.php and paste in your activated theme (for e.g. here I'm pasting it inside my customized child theme of WordPress official theme twentytwenty) in the following path themes/twentytwenty-child/woocommerce/checkout/form-checkout.php
Override the content like this:
<?php
/**
* Checkout Form
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-checkout.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* #see https://docs.woocommerce.com/document/template-structure/
* #package WooCommerce/Templates
* #version 3.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
do_action( 'woocommerce_before_checkout_form', $checkout );
// If checkout registration is disabled and not logged in, the user cannot checkout.
if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ) {
echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'woocommerce' ) ) );
return;
}
?>
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">
<?php if ( $checkout->get_checkout_fields() ) : ?>
<?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>
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
<?php endif; ?>
<?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
<div class="col2-set">
<div class="col-1">
<h3 id="cus-shipping-heading">Shipping Details</h3>
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
</div>
<h3 id="order_review_heading"><?php esc_html_e( 'Your order', 'woocommerce' ); ?></h3>
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?>
<div id="order_review" class="woocommerce-checkout-review-order">
<?php do_action( 'woocommerce_checkout_order_review' ); ?>
</div>
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
</form>
<?php do_action( 'woocommerce_after_checkout_form', $checkout ); ?>
Explaination of the changes:
Removed the shipping section from the div#customer_details
Add that section next to the action hook <?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
Here is the snippet of the section we added:
<div class="col2-set">
<div class="col-1">
<h3 id="cus-shipping-heading">Shipping Details</h3>
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
</div>
After the change the checkout page will look like this:
Related
I created a post_type "Case Studies", created a category template over-ride page and call a Post Grid Shortcode in that category template over-ride but it always ommits the latest post of the type... The post grid shortcode correctly displays all 'Case Studies'.
It is like it has an offset=1...
Code - page named 'category-case-studies.php':
<?php
get_header();
?>
<div <?php echo apply_filters('shrk-page-cover-atts', 'page-cover'); ?> >
<div class="container">
<header class="page-header">
<h1 class="page-title">Case Studies</h1>
</header>
</div><!-- .entry-header -->
<?php do_action('shrk-page-cover-after'); ?>
</div>
<div class="container container-main-content">
<div class="row">
<div class="main-content-inner">
<div class="col-xs-12 col-sm-12 breadcrumb-inner">
<?php
if (function_exists('yoast_breadcrumb')) {
yoast_breadcrumb('<nav id="woocommerce-breadcrumb">', '</nav>');
}
?>
</div>
</div>
</div>
</div>
<div class="container container-main-content">
<div class="row after-breadcrumb">
<div class="main-content-inner col-12 <?php echo esc_attr(shrk_get_main_inner_class()); ?>">
<?php
echo do_shortcode('[vc_row][vc_column][vc_basic_grid post_type="post" max_items="10" element_width="6" grid_id="vc_gid:1575382949300-f7c10d1d-4924-6" taxonomies="96" offset="0"][/vc_column][/vc_row]');
?>
<?php get_sidebar(); ?>
</div><!-- close .*-inner (main-content or sidebar, depending if sidebar is used) -->
</div><!-- close .row -->
</div><!-- close .container .container-main-content -->
<?php get_footer(); ?>
REEALLY odd though... Other category types display all posts of that category type (just checked and yes it does...)
I have a feeling (though I am clutching at straws) that it is something to do with being on a category page of the same name/type as the category type...
Any advice appreciated.
## UPDATE TO INCLUDE do_shortcode()
/**
* Search content for shortcodes and filter shortcodes through their hooks.
*
* If there are no shortcode tags defined, then the content will be returned
* without any filtering. This might cause issues when plugins are disabled but
* the shortcode will still show up in the post or content.
*
* #since 2.5.0
*
* #global array $shortcode_tags List of shortcode tags and their callback hooks.
*
* #param string $content Content to search for shortcodes.
* #param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
* #return string Content with shortcodes filtered out.
*/
function do_shortcode( $content, $ignore_html = false ) {
global $shortcode_tags;
if ( false === strpos( $content, '[' ) ) {
return $content;
}
if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) {
return $content;
}
// Find all registered tag names in $content.
preg_match_all( '#\[([^<>&/\[\]\x00-\x20=]++)#', $content, $matches );
$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
if ( empty( $tagnames ) ) {
return $content;
}
$content = do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames );
$pattern = get_shortcode_regex( $tagnames );
$content = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $content );
// Always restore square braces so we don't break things like <!--[if IE ]>
$content = unescape_invalid_shortcodes( $content );
return $content;
}
Is there a way to create columns for woocommerce, I want it to be 3 columns, column 1(step1) the billing information, column 2(step2) shipping method and payment method, column 3(step3) item details and checkout button, all in one checkout page, or is there a plugin for this?
<?php
/**
* Checkout Form
*
* #author WooThemes
* #package WooCommerce/Templates
* #version 2.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
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 woocommerce-checkout" action="<?php echo esc_url( $get_checkout_url ); ?>" enctype="multipart/form-data">
<?php if ( sizeof( $checkout->checkout_fields ) > 0 ) : ?>
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
<div class="onecheckout">
<div class="step-1">Step One</div>
<?php do_action( 'woocommerce_checkout_billing' ); ?>
</div>
<div class="onecheckoutmid">
<div class="step-2">Step Two</div>
<h6>Delivery Method</h6>
<div class="col-2">
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
</div>
<div class="onecheckout">
<div class="step-3">Step Three</div>
<h6>Confirm Order</h6>
</form>
WooCommerce provides the ability to override their checkout template files by adding a woocommerce directory into your WordPress theme and making any adjustments you need there.
It would require overriding several template files, but with some custom HTML and CSS, you could probably achieve the results you are looking for.
I am having Issue in my checkout page. I am getting Two Place order button(click here). I tried to fix it in form-checkout.php even I checked in form-pay.php, in wp-content/themes/mytheme/woocommerce/checkout.
I checked in wordpress forum I got solution to remove two checkout button from cart page, there is no solution for my problem
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce;
wc_print_notices();
do_action( 'woocommerce_before_checkout_form', $checkout );
// 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="row" id="customer_details">
<div class="col-md-6">
<?php do_action( 'woocommerce_checkout_billing' ); ?>
</div>
<div class="col-md-6">
<?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' ); ?>
Go to wp-content/themes/mytheme/woocommerce/checkout/view-order.php. In View-order.php remove id="payment" completle
This issue is because of theme version
Please check your configuration in your WordPress admin.
Woocommers->settings on the Payment Tab check your information details if you have miss an HTML tags.
I have experience on this when I customized or add some html tags on the details text area with closing "div" tag.
I've been trying to add a filter to my woocommerce code to prevent the form from sending the customer email address to paypal. (Im using paypal standard). Supposedly this will cause the credit card form to be the default display instead of the 'sign in to paypal' option.
I've found this code here:
Paypal Payment Standard default enter card details that should do this, but i'm unsure where to place that code. Here is my /templates/checkout/form-checkout.php which is not working:
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( $get_checkout_url ); ?>" enctype="multipart/form-data">
<?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 function smw_woo_paypal_args($args) {
$args['email'] = '';
return $args;
}
add_filter( 'woocommerce_paypal_args', 'smw_woo_paypal_args', 99);
?>
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
<h3 id="order_review_heading"><?php _e( 'Your order', 'woocommerce' ); ?></h3>
<?php endif; ?>
<div id="order_review" class="woocommerce-checkout-review-order">
<?php do_action( 'woocommerce_checkout_order_review' ); ?>
</div>
</form>
Any ideas on where to place this filter?
Place that filter in your theme's functions.php file. That will make it functional and should leave the email empty as expected.
That said, I don't think that's going to solve your problem. Payments Standard checkout pages are typically cookie based, and if any user has signed in to an account on the browser being used, it will assume that any PayPal checkout will be using that account and will default that way.
If you were to clear your browser cache/cookies, or just use a fresh, clean browser, you'd probably see that the guest checkout option is more prominent.
If you were to use the Express Checkout API, though, you can force this more easily. You're using WooCommerce, so checkout PayPal for WooCommerce, which includes Express Checkout and it's free. There are settings specific to enabling the full guest checkout / credit card option built into the plugin.
Good day everyone, I having this issue with regards to the comments section of my wordpress.org blog. the thing is when my blog got so much comments (around 200+) the comments is pushed down at the bottom of the blog post, until it reaches near the footer. every reader dont want this (me neither).
If any one could help me to edit to re-position the comments box to the top of the comments previously posted. I just want the comments boxes (name, email, website and the comment box) appear first before the comments posted.
It will be much easier for my readers to comments and will also be encouraged to comments.
I don't want to implement the comments pagination because i already tried it and has negative feedback from my readers.
I know its too much to ask to edit those codes below (Im sorry) but I'm not a programmer in nature :( but please kindly help me. I've been reading some tutorials but I cant understand all of them.
my bad.
hope you can help me?
<?php
/**
* The template for displaying Comments.
*
* The area of the page that contains both current comments
* and the comment form. The actual display of comments is
* handled by a callback to twentyten_comment which is
* located in the functions.php file.
*
* #package WordPress
* #subpackage Twenty_Ten
* #since Twenty Ten 1.0
*/
?>
<div id="comments">
<?php if ( post_password_required() ) : ?>
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyten' ); ?></p>
</div><!-- #comments -->
<?php
/* Stop the rest of comments.php from being processed,
* but don't kill the script entirely -- we still have
* to fully load the template.
*/
return;
endif;
?>
<?php
// You can start editing here -- including this comment!
?>
<?php if ( have_comments() ) : ?>
<h3 id="comments-title"><?php
printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),
number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>' );
?></h3>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<div class="navigation">
<div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">←</span> Older Comments', 'twentyten' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
</div> <!-- .navigation -->
<?php endif; // check for comment navigation ?>
<ol class="commentlist">
<?php
/* Loop through and list the comments. Tell wp_list_comments()
* to use twentyten_comment() to format the comments.
* If you want to overload this in a child theme then you can
* define twentyten_comment() and that will be used instead.
* See twentyten_comment() in twentyten/functions.php for more.
*/
wp_list_comments( array( 'callback' => 'twentyten_comment' ) );
?>
</ol>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<div class="navigation">
<div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">←</span> Older Comments', 'twentyten' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
</div><!-- .navigation -->
<?php endif; // check for comment navigation ?>
<?php else : // or, if we don't have comments:
/* If there are no comments and comments are closed,
* let's leave a little note, shall we?
*/
if ( ! comments_open() ) :
?>
<p class="nocomments"><?php _e( '', 'twentyten' ); ?></p>
<?php endif; // end ! comments_open() ?>
<?php endif; // end have_comments() ?>
<?php comment_form(); ?>
</div><!-- #comments -->
the function your looking for is <?php comment_form(); ?> also check the comments.php template and you can edit how there rendered on all posts from one central location.