product

Display woocommerce product dimensions in separate lines

匆匆过客 提交于 2019-12-11 01:54:39
问题 I found the way to display the dimensions in separate lines by copy product-attributes.php file to my child-theme and replace: <?php if ( $display_dimensions && $product->has_dimensions() ) : ?> <tr> <th><?php _e( 'Dimensions', 'woocommerce' ) ?></th> <td class="product_dimensions"><?php echo esc_html( wc_format_dimensions( $product->get_dimensions( false ) ) ); ?></td> </tr> <?php endif; ?> with: <?php if ( $display_dimensions && $product->has_dimensions() ) : ?> <tr> <th>Length</th> <td

How to add Rating to sort list in Magento 1.7

独自空忆成欢 提交于 2019-12-11 01:45:42
问题 Looking for some help adding sort by Rating in Magento. I have added code snippets to toolbar.php which seem to add the sort by Rating but when trying to select it, it gets stuck until I reload the page. Any help would be greatly appreciated. Code can be found below: This is the Toolbar.php file. // Begin new Code $this->getCollection()->joinField('rating', 'review/review_aggregate', 'rating_summary', 'entity_pk_value=entity_id', '{{table}}.store_id=1', 'left'); // End new Code AND // Add

Sort Woocommerce products catalog to alphabetical desc order by default

左心房为你撑大大i 提交于 2019-12-11 01:28:42
问题 In Woocommerce with Avada theme, I am trying to sort products alphabetically in DESC order with the following code: add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' ); function custom_woocommerce_get_catalog_ordering_args( $args ) { $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); if ( 'alphabetical'

Add multiple items to a cart at the same time

对着背影说爱祢 提交于 2019-12-11 01:27:15
问题 I have the following relations : Class CartItem belongs_to :cart belongs_to :product Class Product (<=> category) has_many :cart_items Class Cart has_many :cart_items When someone adds a product to his cart, it creates a line in the CartItem table with cart.id and product.id. I can add et remove a product to a cart on the edit page, it works. But now I would like to add or remove more than one product to a cart at the same time. I just need an input number field when the customer could put

Product custom checkbox option that changes Woocommerce cart item price

亡梦爱人 提交于 2019-12-11 01:06:15
问题 The following code displays a custom checkbox before add to cart button on single product pages: add_action( 'woocommerce_before_add_to_cart_button', 'output_custom_text_field', 0 ); function output_custom_text_field() { //Lots of code then: <input type="checkbox" id="option1" name="option1"> } Now I would like to trap/capture this checkbox option in Woocommerce session and then make a custom price calculations in the following code: function final_cart_update( $cart_object ) { foreach (

Magento - Cannot add products to a manual order within backend of the Admin Panel

为君一笑 提交于 2019-12-11 00:42:09
问题 I'm experiencing an issue where when I go to create an order within the Admin Panel of Magento (1.4.1.1) I can start the order, select the customer, then select the language, it loads all information fine, but when I go to "Add Products I can open that up and select the products, but when I click "Add Selected Product(s) to Order" it shows the loading screen briefly (Please Wait) then it loads nothing. I can add the items from the wishlist over, or the last ordered items, but not new products

Magento - Single Custom Product Attribute with Array of Values

耗尽温柔 提交于 2019-12-11 00:38:23
问题 I have a need in Magento to provide an array custom product attribute that outputs all of its values as list items. The basic premise is a list of product ingredients... on a per product basis we need to enter (for example) water, salt, colourings - and for those to be rendered as a list on the front end. My logic so far has been to use the standard text field attribute, entering comma separated values in the back-end and then to try and use that string as an array from which I can use

Custom decimals in WooCommerce product prices for a product category

雨燕双飞 提交于 2019-12-11 00:36:24
问题 Currently we have set up two decimal places for pricing as a default. The problem: we have a product category which needs to show three decimal points for prices. All other shop products/categories should remain 2 decimal places. Does anyone have a handy snippet or suggestion how to achieve this? 回答1: Bellow you will ind a custom function hooked in wc_get_price_decimals filter hook, that will set 3 decimals product prices for a defined product category in product pages, shop page, category

WordPress WooCommerce Variation Dropdown Html Override

南笙酒味 提交于 2019-12-11 00:19:38
问题 Basically, I want to convert my variation dropdown into something fancy, like for example, make it a radio button. But this filter is not working. As a sample, I'm using it like this. add_filter( 'woocommerce_dropdown_variation_attribute_options_html', 'override_color_variation_display', 10, 2 ); public function override_color_variation_display( $html, $args ) { $html = 'Some override'; return $html; } Is this the correct way to get this working? Because it's not showing the "Some override"

List product categories hierarchy from a product id in Woocommerce

北城余情 提交于 2019-12-10 23:33:13
问题 I have a products that can be in multiple categories, example take a look at the following strings: Cat1>Product1 Cat1>Product2 Cat2>subcat1>Product1 Cat3>subcat1>subcat2>Product1 In woocommerce, if I have a productid, I can do the following: function alg_product_categories_names2( $atts ) { $product_cats = get_the_terms( $this->get_product_or_variation_parent_id( $this->the_product ), 'product_cat' ); $cats = array(); $termstest= ''; if ( ! empty( $product_cats ) && is_array( $product_cats )