Skip to content

Commit

Permalink
Styling WooCommerce template also getting all products
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Moraes committed Oct 15, 2018
1 parent 90c45c5 commit 947552b
Show file tree
Hide file tree
Showing 28 changed files with 11,082 additions and 53 deletions.
32 changes: 32 additions & 0 deletions app/config/wp/woo-custom-checkout-fields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php


/**
* Edit WooCommerce Checout Fields
*/

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_company']);

$fields['billing']['billing_cpf'] = array(
'label' => __('CPF', 'woocommerce'),
'placeholder' => _x('CPF', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array('form-row-wide'),
'clear' => true
);

return $fields;
}

/**
* Display field value on the order edit page
*/

add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );

function my_custom_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('CPF').':</strong> ' . get_post_meta( $order->get_id(), '_billing_cpf', true ) . '</p>';
}
16 changes: 16 additions & 0 deletions app/config/wp/woo-custom-functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* Handle Custom WooCommerce Redirects
*/
add_action('template_redirect', 'woocommerce_custom_redirections');

function woocommerce_custom_redirections() {
/* Case1: Non logged user on checkout page (cart empty or not empty) */
if ( !is_user_logged_in() && is_checkout() )
wp_redirect( get_permalink( get_option('woocommerce_myaccount_page_id') ) );

/* Case2: Logged user on my account page with something in cart */
// if( is_user_logged_in() && ! WC()->cart->is_empty() && is_account_page() )
// wp_redirect( get_permalink( get_option('woocommerce_checkout_page_id') ) );
}
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

// Bootstrapping theme
require_once __DIR__ . '/app/bootstrap.php';
require_once __DIR__ . '/app/bootstrap.php';
3 changes: 3 additions & 0 deletions resources/assets/sass/pages/_tickets.sass
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
padding: 17px 0
border-radius: 50%

&__items
display: flex

&__item
margin-top: 15px

Expand Down
14 changes: 14 additions & 0 deletions resources/assets/sass/woocommerce/_common.sass
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,17 @@ span.onsale

&:hover
color: inherit

.woocommerce-order-details__title
@extend .title

.woocommerce-column__title
@extend .subtitle

.checkout-button
@extend .is-primary

.cart_totals
h2
@extend .title
@extend .is-4
34 changes: 34 additions & 0 deletions resources/assets/sass/woocommerce/checkout/_thankyou.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

.woocommerce-thankyou-order-received
&.woocommerce-notice--success
font-size: 28px
padding: 22px
background: #34E990
color: #464646
margin-bottom: 45px
letter-spacing: 2.5px

+mobile
font-size: 22px

.woocommerce-thankyou-order-failed
&.woocommerce-notice--error
font-size: 28px
padding: 22px
background: #dc4649
color: #464646
margin-bottom: 45px
letter-spacing: 2.5px

+mobile
font-size: 22px

thead
.woocommerce-table__product-name
&.product-name
background: #e4e4e4

.woocommerce-table__product-table
&.product-total
background: #e4e4e4

2 changes: 1 addition & 1 deletion resources/assets/sass/woocommerce/index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
@import common
@import single-product
@import tease-product

@import checkout/thankyou
File renamed without changes.
6 changes: 0 additions & 6 deletions static/css/app.2db7cd36948ca890d789.css

This file was deleted.

Loading

0 comments on commit 947552b

Please sign in to comment.