Search the Community
Showing results for tags 'woocommerce'.
-
Hi, could you please help me with an issue? I want to hide the price for one product in the WooCommerce emails that I send to the clients Only If the quantity of a product is over 50. For all the other items I want the price to be shown. For example, the order has 2 products, one with 30pcs quantity that displays price, and the other with 120pcs quantity but with a text 'some text' instead of the price. I modified the email-order-items.php, <?PHP echo $order->get_formatted_line_subtotal($item); ?> But, It's not working. I'm sure is this line but I don't know how to continue and I'm stuck. Thank you so much.
- 2 replies
-
- woocommerce
- wordpress
-
(and 1 more)
Tagged with:
-
Good afternoon, I have a Wordpress website and I'm currently about to update my Woocommerce plugin but was wondering if I could have some advice please? I have the main Woocommerce plugin, Woocommerce Admin and Woocommerce Stripe Gateway. I'm wondering which order would be best to update them in? Does anyone have experience in doing this? Many thanks for any help you can give me. BSD
-
I want to have a search form in one page which has 2 text input fields and a search button. the output should be search results based on below logic: Input1 - category 1 Input2 - category2, common products of category 1 and 2 should be displayed in the search results. I have tried the below code which returns a blank page: Page code: <form action="http://mysite/wp-content/themes/test.php" method="post" name="SearchForm">Cat1 <input id="cat1" name="cat1" type="text" /> Cat2 <input id="cat2" name="cat2" type="text" /> <input type="submit" value="Search" /></form> Test.php contents: <?php $cat1=$_POST["cat1"]; $cat2=$_POST["cat2"]; define('WP_USE_THEMES', false); require_once('../../wp-load.php'); $args = array( 'post_type' => 'product', 'posts_per_page' => 50, 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $cat1 ), array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $cat2 ) ), ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); endwhile; } wp_reset_postdata(); ?> And I am searching with 'cat1' and 'cat2' as inputs in the search form, the slugs for categories are cat1 and cat2 defines in Wordpress. Please help me I am new to PHP. Thanks
-
- phpwordpress
- search
-
(and 2 more)
Tagged with:
-
Trying to add a product search bar to Wordpress admin bar backend that will do Woocommerce product search. It will be located in the backend Admin Menu bar a top so that no matter where you are in back end it will allow to search woo's products. I am close but faulting at small stumbling block. When trying to use the search it is defaulting to post search instead of products. //Add Search To Admin Bar function boatparts_admin_bar_form() { global $wp_admin_bar; $wp_admin_bar->add_menu(array( 'id' => 'boatparts_admin_bar_form', 'parent' => 'top-secondary', 'title' => '<form method="get" action="'.get_site_url().'/wp-admin/edit.php?post_type=product"> <input name="s" type="text" style="height:20px;margin:5px 0;line-height:1em;"/> <input type="submit" style="height:18px;vertical-align:top;margin:5px 0;padding:0 2px;" value="Search Products"/> </form>' )); } add_action('admin_bar_menu', 'boatparts_admin_bar_form'); Have it in my child theme's function.php. Driving me nuts trying to figure it out.
- 1 reply
-
- wordpress
- woocommerce
-
(and 1 more)
Tagged with:
-
Hello i am working with woocommerce where i have products displayed on shop page now i want that user can purchase product only once. So i am trying to get the orders of user and trying to redirect to the user to my account page so i am using following code in functions.php <?php $user_id = get_current_user_id(); $current_user= wp_get_current_user(); $customer_email = $current_user->email; $args = array( 'post_type' => 'product', 'posts_per_page' => 12 ); $loop = new WP_Query( $args ); if ( $loop->have_posts() and is_page( 1036 )) { echo "has post"; } else { echo do_shortcode('[ recent_products per_page=20" columns="4" orderby="rand" order="rand]'); } ?> but its not working anyone can help.
-
Hello, I am trying to make the buy product button on all single product pages to open in a popup iframe or simular! I am new to java, php and such and I am looking for how to achieve this? I have been researching this for over a month and nothing seems to work. I am affiliated with Amazon so I need my woocommerce buy product buttons to open a new smaller popup window in front of my site! I have already had it set to open as _blank, But I really need all my external product button links to open as a popup! Is this possible? I have tried editing cart.php and I know nothing about java. Please help!! Thank you in advance, Dee
-
- woocommerce
- popup
-
(and 1 more)
Tagged with:
-
Hi Everyone I'm working with the woo commerece plugin and i'd like to have a sub heading under the title of each product. Style and format is sorted however i want a particular Category to show in the sub heading section. I've managed to get as far as showing all categories but i want to narrow this down to just one category that is under a parent category. Below is the code i am using, could anyone suggest how i could achieve showing any child category selected under a parent category. Thanks <?php /** * Single Product title * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $post, $product; $cat_count = sizeof( get_the_terms( $post->ID, 'product_cat' ) ); ?> <h1 itemprop="name" class="product_title entry-title"><?php the_title(); ?></h1> <?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Artist:', 'Artist:', $cat_count, 'woocommerce' ) . ' ', '.</span>' ); ?>
-
I am trying to use a Wordpress module called WooCommerce PDF Invoices to make event tickets by modifying the layout of the invoice to create an online ticket to printout. I've successful reformatted the layout and it works like a charm except for one thing. The problem I have is that no matter what is bought the invoice reads "This is a ticket" which I hardcoded into the invoice design. What I would like is an if/then statement inserted into the invoice design that will print between "This is a ticket" or "This is a receipt" depending on if they purchase one of the 4 ticket items. I completely redesigned the woocommerce pdf invoice to look like an online ticket. The first half looks like an actual ticket. <?php global $wpo_wcpdf; ?> <table align="center" cellpadding="0" cellspacing="0" class="pdfbackground" style="width: 700px; height: 350px"> <tr> <td style="width: 20px"> </td> <td style="width: 285px"> </td> <td style="width: 300px"> </td> <td style="width: 75px"> </td> <td style="width: 20px"> </td> </tr> <tr> <td rowspan="4" style="width: 20px"> </td> <td class="pdflogo" rowspan="4" style="width: 285px"><br /><div id="container"><div><?php if( $wpo_wcpdf->get_header_logo_id() ) { $wpo_wcpdf->header_logo(); } else { _e( 'Ticket', 'wpo_wcpdf' ); } ?></div><div class="order-information"> <br /><br /><hr width=50% color=#0087E1><?php $date_setting = isset($wpo_wcpdf->settings->template_settings['display_date'])?$wpo_wcpdf->settings->template_settings['display_date']:'order_date'; $number_setting = isset($wpo_wcpdf->settings->template_settings['display_number'])?$wpo_wcpdf->settings->template_settings['display_number']:'order_number'; // set $display date & label to user setting if ( $date_setting == 'invoice_date' ) { $display_date = $wpo_wcpdf->get_invoice_date(); $display_date_label = __( 'Event Date:', 'wpo_wcpdf' ); } else { $display_date = $wpo_wcpdf->get_order_date(); $display_date_label = __( 'Order Date:', 'wpo_wcpdf' ); } // set $display number & label to user setting if ( $number_setting == 'invoice_number' ) { $display_number = $wpo_wcpdf->get_invoice_number(); $display_number_label = __( 'Transaction Number:', 'wpo_wcpdf' ); } else { $display_number = $wpo_wcpdf->get_order_number(); $display_number_label = __( 'Order Number:', 'wpo_wcpdf' ); } ?> <span class="order-date-label"><?php echo $display_date_label; ?></span> <span class="order-date"><?php echo $display_date; ?></span><br /> <span class="order-number-label"><?php echo $display_number_label; ?></span> <span class="order-number"><?php echo $display_number; ?></span><br /> <br /> <br /> </div></div></td> <td style="width: 300px"><div class="shop-name"><h3><?php $wpo_wcpdf->shop_name(); ?></h3><br /> SPONSORED BY: <br />SPONSOR 1 LOGO | SPONSOR 2 LOGO </div> </td> <td rowspan="4" style="width: 75"><br /><br /><br /><br /><br /><br /> <img alt="" height="126" src="http://www.3corlando.com/wp-content/uploads/2014/06/barcode.png" width="71" class="barcode" /></td> <td rowspan="4" style="width: 20px"> </td> </tr> <tr> <td style="width: 300px"><hr width=75% color=#0087E1><div class="shop-address"><?php $wpo_wcpdf->shop_address(); ?></div> </td> </tr> <tr> <td style="width: 300px"> </td> </tr> <tr> <td style="width: 300px"></td> </tr> <tr> <td class="pdfborder" style="width: 20px"> </td> <td class="pdfticket" colspan="3"><div class="pdfticket"><hr width=50% color=#0087E1>***This is a Receipt*** </div> </td> <td class="pdfborder" style="width: 20px"> </td> </tr> </table> And the second half looks like an invoice. <!-- head container --> <hr> <table class="order-details"> <thead> <tr> <th class="product-label"><?php _e('Shop Items', 'wpo_wcpdf'); ?></th> <th class="quantity-label"><?php _e('Quantity', 'wpo_wcpdf'); ?></th> <th class="price-label"><?php _e('Price', 'wpo_wcpdf'); ?></th> </tr> </thead> <tbody> <?php $items = $wpo_wcpdf->get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item ) : ?><tr> <td class="description"> <?php $description_label = __( 'Description', 'wpo_wcpdf' ); // registering alternate label translation ?> <span class="item-name"><?php echo $item['name']; ?></span><span class="item-meta"><?php echo $item['meta']; ?></span> <dl class="meta"> <?php if( !empty( $item['sku'] ) ) : ?><dt><?php _e( 'SKU:', 'wpo_wcpdf' ); ?></dt><dd><?php echo $item['sku']; ?></dd><?php endif; ?> <?php if( !empty( $item['weight'] ) ) : ?><dt><?php _e( 'Weight:', 'wpo_wcpdf' ); ?></dt><dd><?php echo $item['weight']; ?><?php echo get_option('woocommerce_weight_unit'); ?></dd><?php endif; ?> </dl> </td> <td class="quantity"><?php echo $item['quantity']; ?></td> <td class="price"><?php echo $item['order_price']; ?></td> </tr><?php endforeach; endif; ?> </tbody> <tfoot> <tr class="no-borders"> <td class="no-borders" colspan="3"> <table class="totals"> <tfoot> <?php foreach( $wpo_wcpdf->get_woocommerce_totals() as $total ) : ?> <tr> <td class="no-borders"> </td> <th class="description"><?php echo $total['label']; ?></th> <td class="price"><span class="totals-price"><?php echo $total['value']; ?></span></td> </tr> <?php endforeach; ?> </tfoot> </table> </td> </tr> </tfoot> </table><!-- order-details --> <table class="notes container"> <tr> <td colspan="3"> <div class="notes-shipping"> <?php if ( $wpo_wcpdf->get_shipping_notes() ) : ?> <h3><?php _e( 'Customer Notes', 'wpo_wcpdf' ); ?></h3> <?php $wpo_wcpdf->shipping_notes(); ?> <?php endif; ?> </div> </td> </tr> </table><!-- notes container --> <?php if ( $wpo_wcpdf->get_footer() ): ?> <div id="footer"> <?php $wpo_wcpdf->footer(); ?> </div><!-- #letter-footer --> <?php endif; ?> I want to identify one of my 4 ticket items that may appear where the invoice prints the items and when one of them does appear it changes "This is a receipt" to "This is a ticket" in the first half. Is something like this possible? If so, can anyone give me a direction to find the coding for this? Can anybody give me an idea how to write this in php. I'm a pro at html but I've only taught myself how to modify existing php coding. I can't write it from scratch. Any help is appreciated.
- 3 replies
-
- wordpress
- woocommerce
-
(and 2 more)
Tagged with:
-
Hello Everyone I have been looking over the internet for a few hours now. But I could not find solution to my problem. I am having trouble changing the default view of the products being displayed in the shop page. They are like thumbnails, I can change how many of them will appear on a line or on a page. But I want to change the view to list. I want a list of products to appear with the add to cart button. I am sending a link as an example to how i actually want it to be http://abduls.biz/shop/
-
I was wondering if there is a way to switch the display of woocommerce hooks on my single product page shop. I would like to remove: add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); and replace that with my product description. Here is my Woocommerce-hooks.php file. Any help would be greatly appreciated. <?php /** * WooCommerce Hooks * * Action/filter hooks used for WooCommerce functions/templates * * @author WooThemes * @category Core * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** Template Hooks ********************************************************/ if ( ! is_admin() || defined('DOING_AJAX') ) { /** * Content Wrappers * * @see woocommerce_output_content_wrapper() * @see woocommerce_output_content_wrapper_end() */ add_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); add_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); /** * Sale flashes * * @see woocommerce_show_product_loop_sale_flash() * @see woocommerce_show_product_sale_flash() */ add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 ); add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 ); /** * Breadcrumbs * * @see woocommerce_breadcrumb() */ add_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); /** * Sidebar * * @see woocommerce_get_sidebar() */ add_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); /** * Archive descriptions * * @see woocommerce_taxonomy_archive_description() * @see woocommerce_product_archive_description() */ add_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); add_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 ); /** * Products Loop * * @see woocommerce_show_messages() * @see woocommerce_result_count() * @see woocommerce_catalog_ordering() */ add_action( 'woocommerce_before_shop_loop', 'woocommerce_show_messages', 10 ); add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); /** * Product Loop Items * * @see woocommerce_show_messages() * @see woocommerce_template_loop_add_to_cart() * @see woocommerce_template_loop_product_thumbnail() * @see woocommerce_template_loop_price() * @see woocommerce_template_loop_rating() */ add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); /** * Subcategories * * @see woocommerce_subcategory_thumbnail() */ add_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10 ); /** * Before Single Products * * @see woocommerce_show_messages() */ add_action( 'woocommerce_before_single_product', 'woocommerce_show_messages', 10 ); /** * Before Single Products Summary Div * * @see woocommerce_show_product_images() * @see woocommerce_show_product_thumbnails() */ add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); add_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 ); /** * After Single Products Summary Div * * @see woocommerce_output_product_data_tabs() * @see woocommerce_upsell_display() * @see woocommerce_output_related_products() */ add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); /** * Product Summary Box * * @see woocommerce_template_single_title() * @see woocommerce_template_single_price() * @see woocommerce_template_single_excerpt() * @see woocommerce_template_single_meta() * @see woocommerce_template_single_sharing() */ add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 ); /** * Product Add to cart * * @see woocommerce_template_single_add_to_cart() * @see woocommerce_simple_add_to_cart() * @see woocommerce_grouped_add_to_cart() * @see woocommerce_variable_add_to_cart() * @see woocommerce_external_add_to_cart() */ add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); add_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 ); add_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 ); add_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 ); add_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 ); /** * Pagination after shop loops * * @see woocommerce_pagination() */ add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); /** * Product page tabs */ add_filter( 'woocommerce_product_tabs', 'woocommerce_default_product_tabs' ); add_filter( 'woocommerce_product_tabs', 'woocommerce_sort_product_tabs', 99 ); /** * Checkout * * @see woocommerce_checkout_login_form() * @see woocommerce_checkout_coupon_form() * @see woocommerce_order_review() */ add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_login_form', 10 ); add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 ); add_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 ); /** * Cart * * @see woocommerce_cross_sell_display() */ add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); /** * Footer * * @see woocommerce_demo_store() */ add_action( 'wp_footer', 'woocommerce_demo_store' ); /** * Order details * * @see woocommerce_order_details_table() * @see woocommerce_order_details_table() */ add_action( 'woocommerce_view_order', 'woocommerce_order_details_table', 10 ); add_action( 'woocommerce_thankyou', 'woocommerce_order_details_table', 10 ); } /** Store Event Hooks *****************************************************/ /** * Shop Page Handling and Support * * @see woocommerce_template_redirect() * @see woocommerce_nav_menu_item_classes() * @see woocommerce_list_pages() */ add_action( 'template_redirect', 'woocommerce_template_redirect' ); add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 ); add_filter( 'wp_list_pages', 'woocommerce_list_pages' ); /** * Logout link * * @see woocommerce_nav_menu_items() */ add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_items', 10, 2 ); /** * Clear the cart * * @see woocommerce_empty_cart() * @see woocommerce_clear_cart_after_payment() */ if ( get_option( 'woocommerce_clear_cart_on_logout' ) == 'yes' ) add_action( 'wp_logout', 'woocommerce_empty_cart' ); add_action( 'get_header', 'woocommerce_clear_cart_after_payment' ); /** * Disable admin bar * * @see woocommerce_disable_admin_bar() */ add_filter( 'show_admin_bar', 'woocommerce_disable_admin_bar', 10, 1 ); /** * Cart Actions * * @see woocommerce_update_cart_action() * @see woocommerce_add_to_cart_action() * @see woocommerce_load_persistent_cart() */ add_action( 'init', 'woocommerce_update_cart_action' ); add_action( 'init', 'woocommerce_add_to_cart_action' ); add_action( 'wp_login', 'woocommerce_load_persistent_cart', 1, 2 ); /** * Checkout Actions * * @see woocommerce_checkout_action() * @see woocommerce_pay_action() */ add_action( 'init', 'woocommerce_checkout_action', 20 ); add_action( 'init', 'woocommerce_pay_action', 20 ); /** * Login and Registration * * @see woocommerce_process_login() * @see woocommerce_process_registration() */ add_action( 'init', 'woocommerce_process_login' ); add_action( 'init', 'woocommerce_process_registration' ); /** * Product Downloads * * @see woocommerce_download_product() */ add_action('init', 'woocommerce_download_product'); /** * Analytics * * @see woocommerce_ecommerce_tracking_piwik() */ add_action( 'woocommerce_thankyou', 'woocommerce_ecommerce_tracking_piwik' ); /** * RSS Feeds * * @see woocommerce_products_rss_feed() */ add_action( 'wp_head', 'woocommerce_products_rss_feed' ); /** * Order actions * * @see woocommerce_cancel_order() * @see woocommerce_order_again() */ add_action( 'init', 'woocommerce_cancel_order' ); add_action( 'init', 'woocommerce_order_again' ); /** * Star Ratings * * @see woocommerce_add_comment_rating() * @see woocommerce_check_comment_rating() */ add_action( 'comment_post', 'woocommerce_add_comment_rating', 1 ); add_filter( 'preprocess_comment', 'woocommerce_check_comment_rating', 0 ); /** * Filters */ add_filter( 'woocommerce_short_description', 'wptexturize' ); add_filter( 'woocommerce_short_description', 'convert_smilies' ); add_filter( 'woocommerce_short_description', 'convert_chars' ); add_filter( 'woocommerce_short_description', 'wpautop' ); add_filter( 'woocommerce_short_description', 'shortcode_unautop' ); add_filter( 'woocommerce_short_description', 'prepend_attachment' ); add_filter( 'woocommerce_short_description', 'do_shortcode', 11 ); // AFTER wpautop() woocommerce-hooks.php
-
- woocommerce
- hooks
-
(and 2 more)
Tagged with:
-
Hi, i'm new to this forum, and no coder at all, but i need some help in creating a filter in woocommerce. i was trying to set a filter that would wide the cash-on-delivery payment when the costumer selects a specific shipping zone.(for out-of-town deliveries). I'm using the Table Rates Plug-in I was looking at this code (https://github.com/woothemes/woocommerce/issues/1499) at the answer by maxrice, but i can't adapt it to suite my needs, My zone_id to exclude cod payment is table_rate-3 Thanks in advance
-
- woocommerce
- cod
-
(and 2 more)
Tagged with:
-
I was wondering if anybody would be so kind as to help me write a woocommerce function. I am by no means a coder so i really appreciate any help you can offer. What i wish to achieve is for a function to calculate the quantity of items in cart and then change the total order price based on predefined values. So for example all items are £2.50 .. what i want is for the function to count the items and if 5 items are in the cart change the cart total to £10 .. if 10 items are added change the cart total to £20.00. I am aware of some discount plugins which may achieve something similar, but i don't actually want to apply a discount, i would really prefer to change the total automatically and not display a discount. Once again i greatly appreciate any help.