auto complete order paid2

auto complete order paid2

/** * AUTO COMPLETE PAID ORDERS IN WOOCOMMERCE */ add_action( ‘woocommerce_thankyou’, ‘custom_woocommerce_auto_complete_paid_order’, 10, 1 ); function custom_woocommerce_auto_complete_paid_order( $order_id ) { if ( ! $order_id ) return; $order = wc_get_order( $order_id ); // No updated status for orders delivered with Bank wire, Cash on delivery and Cheque payment methods. if ( ( ‘bacs’ == get_post_meta($order_id, ‘_payment_method’,…

which line will generate a random number between 1 to 10 javascript

which line will generate a random number between 1 to 10 javascript

Math.floor(Math.random() * 100) + 1  Here is what the above code is Doing: 1. We’re creating a variable called randomNumber and setting it equal to a random number between 1 and 100. 2. We’re creating a variable called guess and setting it equal to an empty string. 3. We’re creating a variable called guessCount and…

useeffect clearinterval loading

useeffect clearinterval loading

const Loading = () => { const [loadingStatus, setLoadingStatus] = useState(“.”); useEffect(() => { const intervalId = setInterval(() => { setLoadingStatus(ls => ls + “.”); }, 1000); return () => clearInterval(intervalId); }, []); return {`Loading ${loadingStatus}`}; }; Here is what the above code is Doing: 1. We’re using the useState hook to create a state…

componentWillUnmount

componentWillUnmount

class Clock extends React.Component { constructor(props) { super(props); this.state = {date: new Date()}; } componentDidMount() { this.timerID = setInterval( () => this.tick(), 1000 ); } componentWillUnmount() { clearInterval(this.timerID); } tick() { this.setState({ date: new Date() }); } render() { return ( Bonjour, monde ! Il est {this.state.date.toLocaleTimeString()}. ); } } ReactDOM.render( , document.getElementById(‘root’) ); Here…

error * route

error * route

app.get(‘*’, (request, response) => response.status(404).send(‘This route does not exist’)); Here is what the above code is Doing: 1. We’re importing the express module and assigning it to the variable express. 2. We’re creating an instance of express and assigning it to the variable app. 3. We’re creating a route for the root URL (/) or…

woocommerce add button to product list

woocommerce add button to product list

// On functions.php // Add to cart text on product archives (Collection) page add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woocommerce_custom_product_add_to_cart_text’ ); function woocommerce_custom_product_add_to_cart_text() { return __( ‘Comprar’, ‘woocommerce’ ); } Here is what the above code is Doing: 1. It’s adding a filter to the woocommerce_product_add_to_cart_text hook. 2. It’s creating a function called woocommerce_custom_product_add_to_cart_text. 3. It’s returning the text…