Skip to content

OMW / Journal

Category: Tips / Recommendations

Development, design and commerce. Decisions behind better digital products.

13/05/2023 · 1 min read

Add function custom redirect on thanks page woocommerce

add_action('after_setup_theme', 'woocommerce_support'); function woocommerce_support() { add_theme_support('woocommerce'); } add_filter('woocommerce_cart_item_name', 'add_excerpt_in_cart_item_name', 10, 3); function add_excerpt_in_cart_item_name($item_name, $cart_item, $cart_item_key) { $excerpt = wp_strip_all_tags(get_the_excerpt($cart_item['product_id']), true); $style = ' style="font-size:14px; line-height:normal;"';…

Read article
13/05/2023 · 1 min read

Minimum product order woocommerce

/** * For cart */ add_filter('woocommerce_cart_item_quantity', 'trueroman_min_kolvo_cart', 20, 3); function truemisha_min_kolvo_cart($product_quantity, $cart_item_key, $cart_item) { $product = $cart_item['data']; $min = 0; if (567 === $product->get_id()) {…

Read article
13/05/2023 · 1 min read

How to enable the Gutenberg editor in WooCommerce products

add_filter( 'use_block_editor_for_post_type', 'art_enable_rest_for_product', 10, 2 ); add_filter( 'woocommerce_taxonomy_args_product_cat', 'art_show_in_rest_for_product', 10, 1 ); add_filter( 'woocommerce_taxonomy_args_product_tag', 'art_show_in_rest_for_product', 10, 1 ); add_filter( 'woocommerce_register_post_type_product', 'art_show_in_rest_for_product', 10, 1 ); /**…

Read article
20/09/2022 · 1 min read

Woocommerce rest check permissions

REST-API WOOCOMERCE add_filter( 'woocommerce_rest_check_permissions', 'my_woocommerce_rest_check_permissions', 90, 4 ); function my_woocommerce_rest_check_permissions( $permission, $context, $object_id, $post_type ){ return true; } редирект со страницы на страницу RewriteCond %{QUERY_STRING}…

Read article
26/07/2022 · 5 min read

Liqpay payment widget

$liqpay = new LiqPay($public_key, $private_key); $html = $liqpay->cnb_form(array( 'action' => 'pay', 'amount' => '1', 'currency' => 'USD', 'description' => 'description text', 'order_id' => 'order_id_1', 'version'…

Read article
12/02/2022 · 1 min read

Change photo in url

<meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="og:image" content="https://onmywaystudio.net/wp-content/uploads/2018/05/cropped-download-1-1.png;" /> <meta property="og:image:secure_url" content="https://onmywaystudio.net/wp-content/uploads/2018/05/cropped-download-1-1.png"; /> <meta property="og:image:type" content="image/jpeg" /> <meta property="og:image:width" content="400" /> <meta property="og:image:height" content="300" /> <meta…

Read article
12/02/2022 · 1 min read

Adding consent to the WooCommerce Privacy Policy

// Добавление чекбокса add_action( 'woocommerce_review_order_before_submit', 'truemisha_privacy_checkbox', 25 ); function truemisha_privacy_checkbox() { woocommerce_form_field( 'privacy_policy_checkbox', array( 'type' => 'checkbox', 'class' => array( 'form-row' ), 'label_class' => array(…

Read article
04/02/2022 · 2 min read

Product availability in Woocommerce

add_action( 'woocommerce_before_shop_loop_item_title', 'my_sold_out_loop' ); function my_sold_out_loop() { global $product; if ( !$product->is_in_stock() ) { echo '<span class="soldout">Нет в наличии</span>'; } } add_action( 'woocommerce_before_single_product_summary', 'my_sold_out_loop' );…

Read article
30/01/2022 · 1 min read

Add field to user profile wordpress and woocommerce

function my_user_contactmethods($user_contactmethods){ $user_contactmethods['phone'] = 'Телефон'; return $user_contactmethods; } add_filter('user_contactmethods', 'my_user_contactmethods'); <p class="form-row form-row-wide"> <label for="phone">Phone</label> <input type="text" class="input-text" name="phone" id="phone" value="<?php echo esc_attr( $user->phone );…

Read article
26/12/2021 · 1 min read

Enable phone field validation in woocommerce

// Custom validation for Billing Phone checkout field add_action('woocommerce_checkout_process', 'custom_validate_billing_phone'); function custom_validate_billing_phone() { $is_correct = preg_match('^((8|+7)[- ]?)?((?d{3})?[- ]?)?[d- ]{7,10}$', $_POST['billing_phone']); if ($_POST['billing_phone'] && !$is_correct) {…

Read article
16/07/2021 · 1 min read

Show password by icon

<div class=»password»> <input type=»password» id=»password-input» placeholder=»Введите пароль» name=»password» value=»123456″> <a href=»#» class=»password-control»></a> </div> <style type=»text/css»> .password { width: 300px; margin: 15px auto; position: relative; }…

Read article
20/04/2021 · 5 min read

Install Symfony Framework

Создание проекта   Чтобы создать новый Symfony проект, основанный на одном из официальных шаблонов, нужно запустить команду:   $ symfony new [--full | --demo] <path-to-project>…

Read article
19/04/2021 · 4 min read

Install Laravel on Ubuntu

System requirements Your system must meet the following requirements to be able to run the latest version of Laravel: PHP> = 7.1.3 with OpenSSL, PDO,…

Read article