Henry Hawksworth punched the officer in the face as he was detained over the raid at the McColl's store in South Kirkby, near Pontefract.
Leeds Crown Court heard Hawksworth, 22, went into the store on Mill Lane on January 31 this year and stole beer worth £10 before leaving.
He returned to the premises at 10pm that evening and was challenged by a member of staff over the earlier theft of alcohol.
Hawksworth took out a knife and threatened the woman with it before taking more beer.
The defendant attacked the police officer two days later as he was arrested.
The court heard the officer went to a number of addresses in search of Hawksworth after he was identified as the culprit in the robbery.
Hawksworth became aggressive as he was approached by the officer before punching him in the face.
The officer needed hospital treatment after suffering a broken nose.
He had time off work due to the injury and struggled to breathe and sleep properly.
Hawksworth, of Willow Lane, Featherstone, pleaded guilty to robbery, theft, possession of a bladed article and assaulting an emergency worker.
Andrew Stranex, mitigating, said the offending took place around the time of the second anniversary of the death of his child.
Mr Stranex said Hawksworth had been abusing alcohol to cope with his grief.
The barrister said the defendant was sorry for what he had done and was taking steps to address his offending behaviour while in custody.
Hawksworth was jailed for three years.
The Recorder of Leeds, Judge Guy Kearl, QC, said: "This was a robbery upon a shop involving people who ought never to be threatened, let alone with a knife.
"There were other people present and it was at night."