WC 2.2 order statuses: plugin compatibility

Develop WooCommerce

Orders can have several statuses in WooCommerce; completed, processing, on-hold, pending to name a few.

In WooCommerce 2.1, statuses were associated with orders via a taxonomy called shop_order_status. The shop_order_status taxonomy is no more in 2.2.

Instead, 2.2 uses post_status for the order status. In terms of usage, this makes more sense – regular post statuses are of little use for orders (since when did you have a non-published order?). For performance, using post status has several benefits, particulary to queries and reporting which can now contain less table joins.

How does this affect developers? If you query shop_order posts via a get_posts() function, or DB query, you will need to modify your code to fully support 2.2. Otherwise you’ll either get a notice, or no results.

If you are calling get_posts() for the shop_order post type

Here is an example of a 2.1 order query:

$orders = get_posts( array(…

View original post 240 more words

Magento 2: Add new tab in Product detail page

New tab in product detail page is very easy task with product attribute. Use below steps and check it out.

Step 1. Create Product Attribute “video”.

Step 2. Create file “catalog_product_view.xml” in the app/design/frontend/{vender name}/{theme name}/Magento_Catalog/layout

In the file write the below code:

<!-- this is code to add new tab start -->
<referenceBlock name="product.info.details">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.video" template="product/view/attribute.phtml" group="detailed_info">
<argument name="at_call" xsi:type="string">getVideo</argument>
<argument name="at_code" xsi:type="string">video</argument>
<argument name="css_class" xsi:type="string">video</argument>
<argument name="at_label" xsi:type="string">none</argument>
<argument name="title" translate="true" xsi:type="string">Video</argument>
<!-- this is code to add new tab end -->

Now check in the Detail page.