The site is hosted on XAMPP with apache abd sql. localhost
]]>Moreover, the real game-changer for us was the ability to develop an extension of the plugin called “Enlighter – Extension With Run Button.” This extension added a unique and invaluable feature to our code blocks – a “Run” button. Now, not only can we showcase our code snippets beautifully, but we can also execute them directly on our website, making it an incredibly powerful tool for educational purposes and demonstrations.
I want to express my heartfelt gratitude to the developers and maintainers of the Enlighter plugin for their dedication to providing such a fantastic tool to the coding community. This plugin has not only improved the overall aesthetics of our website but has also enhanced the user experience for our visitors.
]]>Thank you.
]]>store_url2 = 'https://18.185.149.134/wp-json/wc/store/v1/cart/items'
product = wcapi.get("products/17").json()
response2= requests.get(store_url2) # CART + BU [] >
print( response2.headers.get('nonce' ))
print(response2.headers.get('cart-token'))
print(response2.json())
headers = {
'nonce': response2.headers.get('nonce'),
'cart-token': response2.headers.get('cart-token'),
}
print(payload)# id:17 quantity:1
response3 = requests.post(store_url2, json=payload, headers=headers)
if response3.status_code == 200:
print(response3.status_code)
print("Product added successfully.")
else:
print(response3.status_code)
print("Error while adding the product. Error message:", response3.text)
Expand
So, I have used the Requests
module in Python to add products to my cart. The website is created with WordPress. It includes WooCommerce too. I included nonce
and cart-token
in my code. We made the product purchasable cause it was False, and we made it True. Right now, the website is not accessible. Cause we thought maybe our website must be HTTPS rather than HTTP.
Other than that, can you please check my code to see if it’s right or wrong? I am in the dark here. I need to be able to send it to the cart.
Lastly, I have checked my GET/POST methods.?https://18.185.149.134/wp-json/wc/store/v1/cart/items
?outputs a?[ ]
, which is a cart empty list. I would be so grateful if someone could shine the tunnel ahead. Honestly, thanks in advance. Take care.
store_url2 = 'https://18.185.149.134/wp-json/wc/store/v1/cart/items'
product = wcapi.get("products/17").json()
response2= requests.get(store_url2) # CART + BU [] >
print( response2.headers.get('nonce' ))
print(response2.headers.get('cart-token'))
print(response2.json())
headers = {
'nonce': response2.headers.get('nonce'),
'cart-token': response2.headers.get('cart-token'),
}
print(payload)# id:17 quantity:1
response3 = requests.post(store_url2, json=payload, headers=headers)
if response3.status_code == 200:
print(response3.status_code)
print("Product added successfully.")
else:
print(response3.status_code)
print("Error while adding the product. Error message:", response3.text)
So, I have used the Requests
module in Python to add products to my cart. The website is created with WordPress. It includes WooCommerce too. I included nonce
and cart-token
in my code. We made the product purchasable cause it was False, and we made it True. Right now, the website is not accessible. Cause we thought maybe our website must be HTTPS rather than HTTP.
Other than that, can you please check my code to see if it’s right or wrong? I am in the dark here. I need to be able to send it to the cart.
Lastly, I have checked my GET/POST methods. https://18.185.149.134/wp-json/wc/store/v1/cart/items
outputs a [ ]
, which is a cart empty list. I would be so grateful if someone could shine the tunnel ahead. Truly, thanks in advance. Take care.
Quick question, I know there are advanced notification plugins out there but I am interested in building one with Python as a project for my portfolio. I am in need of advanced notifications for woocommerce (email/text me with orders mostly). I know Python but no other languages. I want to somehow build and integrate this into my wp site. Is something like this possible and if so, any suggestions on how to go about it?
]]>[WordPress version]: 6.2.1
[Server]: Xfree
[Program execution environment]: Jupyter Notebook
[Programming language] python (Python 3.8.5)
【program】
**************************************************** ****************
import requests
import json
AUTH_USER = 'YYYYYYY'
AUTH_PASS = 'XXXX XXXX XXXX XXXX XXXX XXXX'
END_POINT_URL = 'https://YYYYYYY.wp.xdomain.jp/wp-json/wp/v2/posts/'
p_title = "Post"
p_content = "Post"
p_status = "publish"
payload = {
'title': p_title ,
'content' : p_content ,
'status' : p_status,
'slug' : 'python_wp_rest_api_post'
}
headers = {'content-type': "application/json"}
r = requests.post( END_POINT_URL, data=json.dumps(payload) , headers=headers, auth=(AUTH_USER, AUTH_PASS) )
print(r)
**************************************************** ****************
【Execution result】
<Response [403]>
[Confirmed items]
?Application password is already set
?Restrictions on access to “WordPress REST API” from foreign IP addresses have been disabled
?Confirmed that the AUTH_USER and AUTH_PASS values match the actual WordPress username and password
?Confirmed that the endpoint URL is correct
?Confirmed that I'm using the credentials of a user with WordPress administrator privileges
]]>want to run the plugin in the theme Jobify (developed by astoundify.com) for the wp-jobmanager-plugin
look foward to hear from you regards lebrochet
]]>