Skip to content

Instantly share code, notes, and snippets.

View rashedripon's full-sized avatar

Rashed Ripon rashedripon

View GitHub Profile
@rashedripon
rashedripon / state.php
Created October 31, 2022 13:21
Add new state
/**
* Add or modify States
*/
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
function custom_woocommerce_states( $states ) {
$states['DK'] = array(
'DK1' => 'Aarø',
);
<?php
/*
Plugin Name: wpdevguides.com must use plugins
Description: code that is used always
Version: 1.0.0
Author: WP Developer Guides
Author URI: wpdevguides.com
*/
add_filter( 'wc_stripe_payment_request_total_label_suffix', '__return_null' );
@rashedripon
rashedripon / rating.php
Created March 3, 2021 16:49
Show "Be the first to review" when no reviews are available
<?php
/**
* Single Product Rating
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/rating.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@rashedripon
rashedripon / functions.php
Last active March 1, 2021 21:22
Set custom order status for backorder items
// ---------------------
// 1. Register Order Status
add_filter( 'woocommerce_register_shop_order_post_statuses', 'extended_register_custom_order_status' );
function extended_register_custom_order_status( $order_statuses ){
// Status must start with "wc-"
$order_statuses['wc-custom-status'] = array(
'label' => _x( 'Custom Status', 'Order status', 'woocommerce' ),
@rashedripon
rashedripon / simple.php
Created February 14, 2021 21:05
Adding disabled Add to cart button for out of stock products
<?php
/**
* Simple product add to cart
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/simple.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@rashedripon
rashedripon / details.php
Last active November 20, 2020 03:10
Dokan - Hide customer details from vendor dashboard when order status is on-hold
<?php
global $woocommerce, $wpdb;
$order_id = isset( $_GET['order_id'] ) ? intval( $_GET['order_id'] ) : 0;
if ( !dokan_is_seller_has_order( dokan_get_current_user_id(), $order_id ) ) {
echo '<div class="dokan-alert dokan-alert-danger">' . esc_html__( 'This is not yours, I swear!', 'dokan-lite' ) . '</div>';
return;
}
@rashedripon
rashedripon / LogsController.php
Created August 12, 2020 05:57
LogsController
<?php
namespace WeDevs\DokanPro\REST;
use WP_REST_Server;
use WeDevs\Dokan\Abstracts\DokanRESTAdminController;
class LogsController extends DokanRESTAdminController {
/**
@rashedripon
rashedripon / store.php
Created July 15, 2020 13:59
Hide products when Dokan store is closed by adding store open checker in store.php file
<?php
/**
* The Template for displaying all single posts.
*
* @package dokan
* @package dokan - 2014 1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@rashedripon
rashedripon / functions.php
Last active July 1, 2020 04:23
Add store open/close notice on Dokan vendor's order page
add_action('dokan_order_content_inside_before', function() {
$seller_id = dokan_get_current_user_id();
var_dump($seller_id);
global $wp;
$current_url = home_url();
$store_settings_page = $current_url . "/dashboard/settings/store";
@rashedripon
rashedripon / functions.php
Last active February 7, 2022 08:03
Dokan store open-close in single product page
<?php
//Remove the <?php while using it in your theme's functions.php file
//Add store open-show information before single product add-to-cart button
add_action('woocommerce_before_add_to_cart_form', 'dokan_open_close', 1000);
function dokan_open_close() {
global $product;